diff --git a/src/spotify_api.rs b/src/spotify_api.rs index efbebb3d..6b626c1a 100644 --- a/src/spotify_api.rs +++ b/src/spotify_api.rs @@ -105,13 +105,13 @@ impl WebApi { if let Ok(Some(token)) = token_rx.recv() { *api_token.lock().unwrap() = Some(Token { access_token: token.access_token, - expires_in: chrono::Duration::seconds(token.expires_in.into()), + expires_in: chrono::Duration::try_seconds(token.expires_in.into()).unwrap(), scopes: HashSet::from_iter(token.scope), expires_at: None, refresh_token: None, }); *api_token_expiration.write().unwrap() = - Utc::now() + ChronoDuration::seconds(token.expires_in.into()); + Utc::now() + ChronoDuration::try_seconds(token.expires_in.into()).unwrap(); } else { error!("Failed to update token"); }