fix: Don't panic if token is still valid

1. `None` from `update_token` should only mean "no update needed", should not be used for errors. We now panic when worker channel is not set
2. Callers should correctly handle `None` result
This commit is contained in:
Konstantin Sobolev
2024-02-19 13:07:34 -08:00
committed by GitHub
parent d4db350000
commit 5e916fd7ec
3 changed files with 9 additions and 12 deletions

View File

@@ -83,11 +83,10 @@ impl Spotify {
spotify.set_volume(volume);
spotify.api.set_worker_channel(spotify.channel.clone());
ASYNC_RUNTIME
.get()
.unwrap()
.block_on(spotify.api.update_token().unwrap())
.ok();
spotify
.api
.update_token()
.map(move |h| ASYNC_RUNTIME.get().unwrap().block_on(h).ok());
spotify.api.set_user(user);