mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-05-29 06:31:32 +00:00
fix(cron): prevent parallel job result loss on exception
Replace generator-based result collection with explicit per-future handling. Each future is now processed independently with a 600s timeout. Before: _results.extend(f.result() for f in _futures) - One exception stops the generator, remaining results are lost - No timeout: one hung job blocks the entire tick After: as_completed() + per-future try/except - Each future handled independently - 600s timeout prevents indefinite blocking - Failed futures are logged and counted as failures
This commit is contained in:
parent
6158964ff6
commit
7a7e78a360
1 changed files with 6 additions and 1 deletions
|
|
@ -1802,7 +1802,12 @@ def tick(verbose: bool = True, adapters=None, loop=None) -> int:
|
|||
for job in parallel_jobs:
|
||||
_ctx = contextvars.copy_context()
|
||||
_futures.append(_tick_pool.submit(_ctx.run, _process_job, job))
|
||||
_results.extend(f.result() for f in _futures)
|
||||
for f in concurrent.futures.as_completed(_futures, timeout=600):
|
||||
try:
|
||||
_results.append(f.result())
|
||||
except Exception as exc:
|
||||
logger.error("Parallel cron job future failed: %s", exc)
|
||||
_results.append(False)
|
||||
|
||||
# Best-effort sweep of MCP stdio subprocesses that survived their
|
||||
# session teardown during this tick. Runs AFTER every job has
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue