fix: Don't panic when token update fails

* fix a panic when token update fails

sometimes we get an `Err` from `token_rx.recv()`, shouldn't panic in such cases

* chore(docs): Update Changelog

---------

Co-authored-by: Henrik Friedrichsen <henrik@affekt.org>
This commit is contained in:
Konstantin Sobolev
2024-03-02 09:58:49 -08:00
committed by GitHub
parent b70df761f7
commit 9a26c58f8e
2 changed files with 2 additions and 1 deletions

View File

@@ -102,7 +102,7 @@ impl WebApi {
let api_token = self.api.token.clone();
let api_token_expiration = self.token_expiration.clone();
Some(ASYNC_RUNTIME.get().unwrap().spawn_blocking(move || {
if let Some(token) = token_rx.recv().unwrap() {
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()),