Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions streamrip/client/deezer.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import logging

import deezer
import requests
from Cryptodome.Cipher import AES

from ..config import Config
Expand Down Expand Up @@ -40,6 +41,21 @@ def __init__(self, config: Config):
self.logged_in = False
self.config = config.session.deezer

# 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(max_conn * 4, 32),
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(
Expand Down