⚡ Bolt: Optimize Qobuz secret verification by short-circuiting network requests#54
Draft
davidjuarezdev wants to merge 1 commit intomainfrom
Draft
Conversation
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: Refactored
_get_valid_secretinstreamrip/client/qobuz.pyto useasyncio.as_completedinstead ofasyncio.gather.🎯 Why: Previously,
asyncio.gatherwould wait for all test requests (even failures and timeouts) to resolve before returning a valid secret. Usingasyncio.as_completedallows us to immediately return the first successful secret and cancel any remaining pending test requests. This eliminates unnecessary network I/O and entirely removes slow-tail latency in the secret verification step.📊 Impact: This significantly speeds up the Qobuz login flow, especially when checking fallback secrets, by short-circuiting as soon as a valid response is received.
🔬 Measurement: Verify by running
poetry run pytest tests/test_qobuz_client.pyor by attempting a normal login flow and observing faster metadata request initialization times.PR created automatically by Jules for task 14961656784116984754 started by @davidjuarezdev