fix(deezer): silence connection pool warnings by sizing the requests adapter correctly#997
Open
berettavexee wants to merge 2 commits into
Open
fix(deezer): silence connection pool warnings by sizing the requests adapter correctly#997berettavexee wants to merge 2 commits into
berettavexee wants to merge 2 commits into
Conversation
The deezer-py library uses a requests.Session with the default urllib3 pool size (10). When concurrent downloads exceed that limit, urllib3 logs a noisy warning for every discarded connection: "Connection pool is full, discarding connection: api.deezer.com" Instead of silencing the warning with setLevel(ERROR), configure the HTTPAdapter pool sizes to match config.session.downloads.max_connections so the pool is never exhausted and no connections are discarded. Idea from https://github.com/hank-bond/streamrip Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…verflow max_connections controls download concurrency, but each download spawns several concurrent API calls (metadata, track token, GW info) via asyncio.to_thread(). The number of simultaneous requests.Session calls easily exceeds max_connections, causing urllib3 to discard connections and log warnings. Use max(max_connections * 4, 32) as pool_maxsize — a generous ceiling with no memory cost — so the pool is never exhausted. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.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.
Problem
When downloading albums or playlists concurrently, urllib3 logs repeated warnings:
The deezer-py library uses a
requests.Sessionwith the defaultHTTPAdapter, whosepool_maxsizeis 10. Streamrip calls deezer-py from multipleasyncio.to_thread()coroutines running in parallel — one per track being resolved — so the number of simultaneous HTTP connections toapi.deezer.comeasily exceeds the pool ceiling. urllib3 then discards the excess connections and logs a warning for each one.Fix
Mount a custom
HTTPAdapteron the deezer-py session with apool_maxsizelarge enough to absorb concurrent API calls:pool_maxsizeis just a ceiling — urllib3 does not pre-allocate connections — so usingmax(max_connections × 4, 32)has no memory cost and ensures the pool is never exhausted under typical usage.Idea from hank-bond/streamrip.
Test plan
concurrency = true→ no connection pool warningsmax_connections = 10and with lower values (e.g. 3)🤖 Generated with Claude Code