fix: verify_script в thread executor — не блокировать event loop
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) <noreply@anthropic.com>
This commit is contained in:
+5
-2
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user