From 41e97c6a05e8e3fd0d50e04e32b018f88be34089 Mon Sep 17 00:00:00 2001 From: Flowseal Date: Fri, 31 Jul 2026 14:20:58 +0300 Subject: [PATCH] hard limit workers pool --- proxy/pool.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/proxy/pool.py b/proxy/pool.py index 982071c..ac532fd 100644 --- a/proxy/pool.py +++ b/proxy/pool.py @@ -218,6 +218,7 @@ class _WsPool: class _CfWorkerPool: WS_POOL_MAX_AGE = 100.0 + PER_DC_LIMIT = 1 def __init__(self): self._idle: Dict[Tuple[int, str], deque] = {} @@ -258,7 +259,7 @@ class _CfWorkerPool: dc, worker_domain = key try: bucket = self._idle.setdefault(key, deque()) - needed = proxy_config.pool_size - len(bucket) + needed = min(proxy_config.pool_size - len(bucket), self.PER_DC_LIMIT) if needed <= 0: return tasks = [asyncio.create_task(