Skip to content

⚡ Bolt: Optimize Qobuz secret verification short-circuiting#48

Draft
davidjuarezdev wants to merge 1 commit intomainfrom
bolt-optimize-qobuz-secret-check-4626234911601353803
Draft

⚡ Bolt: Optimize Qobuz secret verification short-circuiting#48
davidjuarezdev wants to merge 1 commit intomainfrom
bolt-optimize-qobuz-secret-check-4626234911601353803

Conversation

@davidjuarezdev
Copy link
Copy Markdown
Owner

💡 What: Replaced asyncio.gather with asyncio.as_completed and task cancellation in Qobuz's _get_valid_secret method.
🎯 Why: Previously, the method tested all available app secrets concurrently but waited for all HTTP requests to complete before returning the first valid one. This caused unnecessary network requests, slow-tail latency, and background resource usage.
📊 Impact: Reduces time to check valid secrets by short-circuiting as soon as a successful API response is returned, reducing network overhead and login latency.
🔬 Measurement: Verify by running poetry run pytest tests/test_qobuz_client.py and noting the speedup in login time when multiple secrets are being tested.


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

Replaced `asyncio.gather` with `asyncio.as_completed` in `streamrip/client/qobuz.py` to short-circuit app secret checking, avoiding waiting for all concurrent API calls to finish once a valid secret is found.

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