Skip to content

The agent that grows with you

refactor(cron): drop dead advance_next_run import; wrapper tolerates duplicate ids

kshitij6e786e927ff0
diff --git a/cron/jobs.py b/cron/jobs.py
index 479cf0bee5b..904b8aa3462 100644
--- a/cron/jobs.py
+++ b/cron/jobs.py
@@ -1972,7 +1972,9 @@ def advance_next_run(job_id: str) -> bool:
Returns True if next_run_at was advanced, False otherwise.
"""
- return advance_next_runs([job_id]) == 1
+ # >= 1 (not == 1): a corrupted jobs file with duplicate ids advances
+ # every matching record; the wrapper still reports the advance.
+ return advance_next_runs([job_id]) >= 1
def _machine_id() -> str:
diff --git a/cron/scheduler.py b/cron/scheduler.py
index 431c24ffc80..327a048becc 100644
--- a/cron/scheduler.py
+++ b/cron/scheduler.py
@@ -281,7 +281,7 @@ _LEGACY_HOME_TARGET_ENV_VARS = {
"QQBOT_HOME_CHANNEL": "QQ_HOME_CHANNEL",
}
-from cron.jobs import get_due_jobs, mark_job_run, save_job_output, advance_next_run, advance_next_runs, claim_dispatch, heartbeat_run_claim
+from cron.jobs import get_due_jobs, mark_job_run, save_job_output, advance_next_runs, claim_dispatch, heartbeat_run_claim
from cron.executions import create_execution, finish_execution, mark_execution_running
# Sentinel: when a cron agent has nothing new to report, it can start its