Skip to content

Open-source download manager & offline media toolbox for YouTube, music, social media, learning platforms & 1,800+ sites. Built with Tauri 2.0, Rust & Svelte.

feat: replace blocking lock with try_lock in get_token method for SpotifyAuth and BrowserCookieAuth

Tonho122f80f32940
diff --git a/src-tauri/src/core/auth.rs b/src-tauri/src/core/auth.rs
index 95c32632..0f6e0832 100644
--- a/src-tauri/src/core/auth.rs
+++ b/src-tauri/src/core/auth.rs
@@ -382,7 +382,7 @@ impl PlatformAuth for SpotifyAuth {
}
fn get_token(&self) -> Option<String> {
- let guard = self.session.blocking_lock();
+ let guard = self.session.try_lock().ok()?;
guard.as_ref().and_then(|s| s.token.clone())
}
}
@@ -508,7 +508,7 @@ impl PlatformAuth for BrowserCookieAuth {
}
fn get_token(&self) -> Option<String> {
- let guard = self.session.blocking_lock();
+ let guard = self.session.try_lock().ok()?;
guard.as_ref().and_then(|s| s.token.clone())
}
}