mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-04-25 00:51:20 +00:00
fix(cron): get_due_jobs read jobs.json twice creating race window
get_due_jobs() called load_jobs() twice: once for filtering (with _apply_skill_fields) and once for saving updates. Between the two reads, another process could modify jobs.json, causing the filtering and saving to operate on different versions. Fix: load once, deepcopy for the skill-applied working list.
This commit is contained in:
parent
4433b83378
commit
1f0bb8742f
1 changed files with 3 additions and 2 deletions
|
|
@ -5,6 +5,7 @@ Jobs are stored in ~/.hermes/cron/jobs.json
|
|||
Output is saved to ~/.hermes/cron/output/{job_id}/{timestamp}.md
|
||||
"""
|
||||
|
||||
import copy
|
||||
import json
|
||||
import logging
|
||||
import tempfile
|
||||
|
|
@ -539,8 +540,8 @@ def get_due_jobs() -> List[Dict[str, Any]]:
|
|||
immediately. This prevents a burst of missed jobs on gateway restart.
|
||||
"""
|
||||
now = _hermes_now()
|
||||
jobs = [_apply_skill_fields(j) for j in load_jobs()]
|
||||
raw_jobs = load_jobs() # For saving updates
|
||||
raw_jobs = load_jobs()
|
||||
jobs = [_apply_skill_fields(j) for j in copy.deepcopy(raw_jobs)]
|
||||
due = []
|
||||
needs_save = False
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue