From 9c0aaffd13c4b5911974a37227c235b0c6984372 Mon Sep 17 00:00:00 2001 From: anor Date: Thu, 26 Mar 2026 15:29:00 +1000 Subject: [PATCH] =?UTF-8?q?fix:=20verify=5Fscript=20=D0=B2=20thread=20exec?= =?UTF-8?q?utor=20=E2=80=94=20=D0=BD=D0=B5=20=D0=B1=D0=BB=D0=BE=D0=BA?= =?UTF-8?q?=D0=B8=D1=80=D0=BE=D0=B2=D0=B0=D1=82=D1=8C=20event=20loop?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit verify_script содержит exec() — синхронная блокирующая операция. В async generator это замораживало event loop → SSE events не доставлялись → UI зависал на "Проверяю скрипт на 2 файлах..." Теперь: loop.run_in_executor(None, verify_script, ...) Co-Authored-By: Claude Opus 4.6 (1M context) --- batch_v3.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/batch_v3.py b/batch_v3.py index f25e90b..e104291 100644 --- a/batch_v3.py +++ b/batch_v3.py @@ -264,9 +264,12 @@ async def run_generate_and_verify( yield {"type": "error", "error": "Script not generated", "attempt": attempt} return - # Phase 2: Verify + # Phase 2: Verify (run in thread to avoid blocking event loop) yield {"type": "verify_start", "attempt": attempt} - result = verify_script(script, source_dir, target_file, str(job_dir)) + loop = asyncio.get_event_loop() + result = await loop.run_in_executor( + None, verify_script, script, source_dir, target_file, str(job_dir) + ) if result["ok"]: yield {