From c81969199fb81827812f5e87d0b1ae9eeae70773 Mon Sep 17 00:00:00 2001 From: anor Date: Wed, 28 Oct 2026 10:38:31 +1000 Subject: [PATCH] =?UTF-8?q?fix(=D0=BE=D1=87=D0=B5=D1=80=D0=B5=D0=B4=D1=8C)?= =?UTF-8?q?:=20=D0=BD=D1=83=D0=BB=D0=B5=D0=B2=D0=BE=D0=B9=20=D0=B8=D0=BB?= =?UTF-8?q?=D0=B8=20=D0=BE=D1=82=D1=80=D0=B8=D1=86=D0=B0=D1=82=D0=B5=D0=BB?= =?UTF-8?q?=D1=8C=D0=BD=D1=8B=D0=B9=20=D1=88=D0=B0=D0=B3=20keepalive=20?= =?UTF-8?q?=D0=BD=D0=B5=20=D0=BA=D1=80=D1=83=D1=82=D0=B8=D1=82=20=D1=86?= =?UTF-8?q?=D0=B8=D0=BA=D0=BB=20=D0=B1=D0=B5=D0=B7=20=D0=BF=D0=B0=D1=83?= =?UTF-8?q?=D0=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 5.5 --- claude_bridge.py | 2 ++ tests/test_agent_queue.py | 9 +++++++++ 2 files changed, 11 insertions(+) diff --git a/claude_bridge.py b/claude_bridge.py index 4f949aa..2eb5e0b 100644 --- a/claude_bridge.py +++ b/claude_bridge.py @@ -61,6 +61,8 @@ try: QUEUE_KEEPALIVE = float(os.environ.get("AGENT_QUEUE_KEEPALIVE", "20")) except ValueError: QUEUE_KEEPALIVE = 20.0 +if QUEUE_KEEPALIVE <= 0: # ноль крутил бы keepalive без пауз + QUEUE_KEEPALIVE = 20.0 _waiting = 0 diff --git a/tests/test_agent_queue.py b/tests/test_agent_queue.py index abd2e7f..f2a950b 100644 --- a/tests/test_agent_queue.py +++ b/tests/test_agent_queue.py @@ -115,3 +115,12 @@ def test_limit_comes_from_setting(monkeypatch): monkeypatch.setenv("AGENT_MAX_CONCURRENT", "abc") importlib.reload(claude_bridge) assert claude_bridge.MAX_CONCURRENT == 3 # мусор в настройке — прежний предел + + +def test_zero_keepalive_setting_falls_back(monkeypatch): + # Ноль или минус дали бы бешеный цикл keepalive без пауз (нашёл дипсик 28.10.2026). + import claude_bridge + for bad in ("0", "-5", "abc"): + monkeypatch.setenv("AGENT_QUEUE_KEEPALIVE", bad) + importlib.reload(claude_bridge) + assert claude_bridge.QUEUE_KEEPALIVE == 20.0