⚡ Bolt: optimize qobuz client secret fetching#45
Draft
davidjuarezdev wants to merge 1 commit intomainfrom
Draft
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
💡 What: Replaced
asyncio.gatherwithasyncio.as_completedinstreamrip/client/qobuz.pyfor_get_valid_secretto 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