Skip to content

⚡ Bolt: optimize qobuz client secret fetching#45

Draft
davidjuarezdev wants to merge 1 commit intomainfrom
bolt-qobuz-secret-optimization-14153885978613952560
Draft

⚡ Bolt: optimize qobuz client secret fetching#45
davidjuarezdev wants to merge 1 commit intomainfrom
bolt-qobuz-secret-optimization-14153885978613952560

Conversation

@davidjuarezdev
Copy link
Copy Markdown
Owner

💡 What: Replaced asyncio.gather with asyncio.as_completed in streamrip/client/qobuz.py for _get_valid_secret to return the first working secret immediately. Added cleanup logic to cancel the remaining unused tasks.

🎯 Why: Testing all secrets currently waits for the slowest request (which usually fails) to complete before proceeding, inducing noticeable login latency. We only need ONE valid secret.

📊 Impact: Significantly faster Qobuz login times, fewer HTTP requests to the Qobuz API overall, and reduced risk of hitting rate limits. Short-circuits tail latency of the slowest failed endpoint.

🔬 Measurement: Check the logs during login to Qobuz; it should finish testing secrets much faster and not output warnings for cancelled/aborted requests. Run poetry run pytest tests/ to confirm no breakage.


PR created automatically by Jules for task 14153885978613952560 started by @davidjuarezdev

Replaced asyncio.gather with asyncio.as_completed when testing Qobuz secrets. This enables the client to short-circuit and return the first valid secret immediately rather than waiting for all concurrent tests to finish. The change reduces unnecessary network latency and saves bandwidth by properly canceling the remaining pending requests.

Co-authored-by: davidjuarezdev <230496599+davidjuarezdev@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant