Merge pull request #1716 from NousResearch/fix/cron-double-load-jobs

fix(cron): get_due_jobs reads jobs.json twice — race condition
This commit is contained in:
Teknium 2026-03-17 04:13:39 -07:00 committed by GitHub
commit cac3c4d45f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -5,6 +5,7 @@ Jobs are stored in ~/.hermes/cron/jobs.json
Output is saved to ~/.hermes/cron/output/{job_id}/{timestamp}.md Output is saved to ~/.hermes/cron/output/{job_id}/{timestamp}.md
""" """
import copy
import json import json
import logging import logging
import tempfile 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. immediately. This prevents a burst of missed jobs on gateway restart.
""" """
now = _hermes_now() now = _hermes_now()
jobs = [_apply_skill_fields(j) for j in load_jobs()] raw_jobs = load_jobs()
raw_jobs = load_jobs() # For saving updates jobs = [_apply_skill_fields(j) for j in copy.deepcopy(raw_jobs)]
due = [] due = []
needs_save = False needs_save = False