Skip to content

The agent that grows with you

refactor(cron): probe name covers both bounds; delattr fails loudly; one-line facade import

kshitijk4poorc62bd9f2078a
diff --git a/cron/occurrences.py b/cron/occurrences.py
index 5db596415fe..c083b759ed6 100644
--- a/cron/occurrences.py
+++ b/cron/occurrences.py
@@ -83,9 +83,7 @@ def unclaimed_pending_slot(job, now):
process is honoured while that owner may still be alive within the fire-claim lease — a
second live gateway on the same store is mid-dispatch, not dead."""
from cron.constants import FIRE_CLAIM_TTL_SECONDS
- from cron.jobs import (
- _claim_is_live, _job_running_in_this_process, _machine_id,
- )
+ from cron.jobs import _claim_is_live, _job_running_in_this_process, _machine_id
pending = job.get("pending_slot")
if not isinstance(pending, dict):
diff --git a/tests/cron/test_upgrade_module_skew.py b/tests/cron/test_upgrade_module_skew.py
index 842d33537fa..bd0bcdfbc13 100644
--- a/tests/cron/test_upgrade_module_skew.py
+++ b/tests/cron/test_upgrade_module_skew.py
@@ -33,8 +33,8 @@ import cron.jobs as jobs
# Model a daemon that loaded cron.jobs before these constants existed, then
# lazy-loads the newer occurrences module from disk during a due scan.
-jobs.__dict__.pop("FIRE_CLAIM_SKEW_SECONDS", None)
-jobs.__dict__.pop("FIRE_CLAIM_TTL_SECONDS", None)
+for name in ("FIRE_CLAIM_SKEW_SECONDS", "FIRE_CLAIM_TTL_SECONDS"):
+ delattr(jobs, name)
from cron.occurrences import completed_occurrence, unclaimed_pending_slot
@@ -63,7 +63,7 @@ def test_lazy_cron_stores_import_against_pre_upgrade_sqlite_util(store):
assert result.returncode == 0, result.stderr
-def test_occurrences_uses_skew_constant_without_cached_jobs_export():
+def test_occurrences_resolve_fire_claim_constants_without_cached_jobs_exports():
repo_root = Path(__file__).resolve().parents[2]
result = subprocess.run(
[sys.executable, "-c", _OCCURRENCES_SKEW_SCRIPT],