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 {