From 92166a70545bcf5501b838a18ec6f1aad910ebf6 Mon Sep 17 00:00:00 2001 From: Tsiry Sandratraina Date: Wed, 4 Feb 2026 10:46:27 +0300 Subject: [PATCH] Wrap Spotify search in 5s timeout --- crates/webscrobbler/src/scrobbler.rs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/crates/webscrobbler/src/scrobbler.rs b/crates/webscrobbler/src/scrobbler.rs index d899c686..30bb9562 100644 --- a/crates/webscrobbler/src/scrobbler.rs +++ b/crates/webscrobbler/src/scrobbler.rs @@ -138,8 +138,17 @@ pub async fn scrobble( tracing::info!(query = %query, "Searching on Spotify"); - let result = - retry_spotify_call(|| async { spotify_client.search(&query).await }, "search").await?; + let result = retry_spotify_call( + || async { + tokio::time::timeout( + std::time::Duration::from_secs(5), + spotify_client.search(&query), + ) + .await? + }, + "search", + ) + .await?; tracing::info!(total = %result.tracks.total, "Spotify search results"); -- 2.51.2