From bdb5831c2a7cd8f758d64ae0e61fcedeb89f222b Mon Sep 17 00:00:00 2001 From: berettavexee Date: Sun, 14 Jun 2026 23:43:20 +0200 Subject: [PATCH 1/2] fix(deezer): size requests connection pool to match max_connections 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 --- streamrip/client/deezer.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/streamrip/client/deezer.py b/streamrip/client/deezer.py index 056463f9..9213f46d 100644 --- a/streamrip/client/deezer.py +++ b/streamrip/client/deezer.py @@ -4,6 +4,7 @@ import logging import deezer +import requests from Cryptodome.Cipher import AES from ..config import Config @@ -40,6 +41,17 @@ def __init__(self, config: Config): self.logged_in = False self.config = config.session.deezer + # Size the deezer-py requests session pool to match max_connections so + # urllib3 never needs to discard connections and logs no warnings. + max_conn = config.session.downloads.max_connections + adapter = requests.adapters.HTTPAdapter( + pool_connections=max_conn, + pool_maxsize=max_conn, + max_retries=0, + ) + self.client.session.mount("https://", adapter) + self.client.session.mount("http://", adapter) + async def login(self): # Used for track downloads self.session = await self.get_session( From dd19bc3aabe9933841d832fa5dfee5170b7e3a7b Mon Sep 17 00:00:00 2001 From: berettavexee Date: Sun, 14 Jun 2026 23:50:25 +0200 Subject: [PATCH 2/2] fix(deezer): set pool_maxsize well above max_connections to prevent overflow MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- streamrip/client/deezer.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/streamrip/client/deezer.py b/streamrip/client/deezer.py index 9213f46d..a9c28ed8 100644 --- a/streamrip/client/deezer.py +++ b/streamrip/client/deezer.py @@ -41,12 +41,16 @@ def __init__(self, config: Config): self.logged_in = False self.config = config.session.deezer - # Size the deezer-py requests session pool to match max_connections so - # urllib3 never needs to discard connections and logs no warnings. + # Increase the deezer-py requests session pool well above max_connections. + # Each concurrent download spawns several API calls (metadata, track token, + # GW info…) via asyncio.to_thread(), so the actual number of simultaneous + # requests easily exceeds max_connections. pool_maxsize is just a ceiling — + # no memory is pre-allocated — so a generous value avoids the urllib3 + # "Connection pool is full" warning without any real cost. max_conn = config.session.downloads.max_connections adapter = requests.adapters.HTTPAdapter( pool_connections=max_conn, - pool_maxsize=max_conn, + pool_maxsize=max(max_conn * 4, 32), max_retries=0, ) self.client.session.mount("https://", adapter)