fix: harden _is_recoverable_error_job against schedule=None

job.get("schedule", {}).get("kind") crashes with AttributeError when
schedule is present but explicitly None (disk corruption edge case).
Use (job.get("schedule") or {}).get("kind") instead, which safely
returns False for None. This pattern is already used at other sites
in the file (e.g. cron/scheduler.py line 170).
This commit is contained in:
kshitijk4poor
2026-08-28 02:11:35 +05:30
committed by kshitij
parent ba4c2d5253
commit 939dec1348
+1 -1
View File
@@ -667,7 +667,7 @@ def _is_recoverable_error_job(job: Dict[str, Any]) -> bool:
"""
return (
job.get("state") == "error"
and job.get("schedule", {}).get("kind") in {"cron", "interval"}
and (job.get("schedule") or {}).get("kind") in {"cron", "interval"}
)