fix(cron): import run_job in _run_cron_tracked to fix NameError - #1329
zichen0116 wants to merge 1 commit into
Conversation
Fixes nesquena#1310: Manual cron run crashes with NameError because _run_cron_tracked() calls run_job() without importing it.
|
Heads up: this is the third PR proposing the same one-line fix for #1310 — see #1312 (fecolinhares) and #1317 (jasonjcwu). All three add The diagnosis is correct and matches the bug surface in master:
We will pick one of the three to merge and credit all authors via Co-authored-by trailers. #1317 currently leads because it includes an AST-based regression test that asserts the import is actually present inside the function. The patches are otherwise equivalent. Closing this in favor of #1317 isn't decided yet — leaving open until triage completes. Thanks for the fix. |
|
Thanks @zichen0116! 🙏 Closing this in favor of #1317, which lands the same single-line import fix plus AST-based regression tests under Your other two PRs (#1331 .env.example alignment, #1332 Docker HEALTHCHECK) are both in v0.50.245 — thanks for the cleanup pass! |
Description
Fixes #1310: Manual cron job execution crashes with
NameError: name 'run_job' is not defined.The
_run_cron_tracked()function callsrun_job(job)butrun_jobwas never imported. The function is defined at line 95 inapi/routes.py, butrun_jobis only imported locally inside_handle_cron_run()(line 3503).Fix
Added
from cron.scheduler import run_jobat the top of_run_cron_tracked()function body, matching the existing import pattern used elsewhere in the file.Related