Skip to content

⚡ Bolt: Optimize Qobuz secret verification by short-circuiting network requests#54

Draft
davidjuarezdev wants to merge 1 commit intomainfrom
bolt/qobuz-secret-short-circuit-14961656784116984754
Draft

⚡ Bolt: Optimize Qobuz secret verification by short-circuiting network requests#54
davidjuarezdev wants to merge 1 commit intomainfrom
bolt/qobuz-secret-short-circuit-14961656784116984754

Conversation

@davidjuarezdev
Copy link
Copy Markdown
Owner

💡 What: Refactored _get_valid_secret in streamrip/client/qobuz.py to use asyncio.as_completed instead of asyncio.gather.

🎯 Why: Previously, asyncio.gather would wait for all test requests (even failures and timeouts) to resolve before returning a valid secret. Using asyncio.as_completed allows 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.py or by attempting a normal login flow and observing faster metadata request initialization times.


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

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