The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
perf(cron): let a failed scan save count as the degraded tick's probe
kshitijk4poor8cdc2c2b5bff
diff --git a/cron/store_health.py b/cron/store_health.pyindex 1c4174c7520..7f047880549 100644--- a/cron/store_health.py+++ b/cron/store_health.py@@ -101,7 +101,9 @@ def note_unwritable(cron_dir: Path, exc: OSError, consequence: str, site: str,record = _degraded[store] = StoreDegraded(store, time.time(), describe_error(exc))new_site = site not in record.sitesrecord.sites.add(site)- if site in _DISPATCH_SITES: # a dispatch write failed: throttle the next attempt from here+ # A failed dispatch write throttles the next attempt; once dispatch has been tried, a failed+ # scan save is this tick's write attempt too, so the re-probe does not add a second one.+ if site in _DISPATCH_SITES or record.last_probe is not None:record.last_probe = time.monotonic()record.error = describe_error(exc)record.skipped |= _run_keys(skipped_jobs)diff --git a/tests/cron/test_due_scan_save_failure.py b/tests/cron/test_due_scan_save_failure.pyindex c5980bff44f..0ab54257304 100644--- a/tests/cron/test_due_scan_save_failure.py+++ b/tests/cron/test_due_scan_save_failure.py@@ -172,8 +172,8 @@ def test_dispatch_failure_after_receipt_never_leaves_it_claimed(def test_unwritable_store_degrades_once_throttles_and_catches_up_once(cron_store, monkeypatch):- """One degraded state per outage: entered once, advance/claim skipped between minute-throttled- re-probes, cleared by the first save that lands; then the recurring job and the one-shot that+ """One degraded state per outage: entered once, advance/claim skipped while the scan's save+ keeps failing (one write attempt per tick), cleared by the first save that lands; then the recurring job and the one-shot thatstayed due across 5 ticks each fire ONCE, and the one-shot keeps a single ``failed`` row."""from cron import executions, scheduler@@ -209,8 +209,9 @@ def test_unwritable_store_degrades_once_throttles_and_catches_up_once(cron_storebefore = len(writes)assert scheduler.tick(verbose=False, sync=True) == 0per_tick.append(len(writes) - before)- assert ran == [] and len(probes) == 2- assert per_tick[0] == 3 and per_tick[1:] == [1, 1, 1, 1] # only the scan's save after entry+ # The scan's failing save after entry is each tick's one write attempt: no extra re-probe.+ assert ran == [] and len(probes) == 0+ assert per_tick[0] == 3 and per_tick[1:] == [1, 1, 1, 1]assert events == [("unwritable", 0)]# Distinct (job, due instant): the unpersisted fast-forward keeps both on one instant each.assert store_health.degraded_record(cron_store / "cron").skipped_runs == 2