fix(cron): report ownerless interrupted fires so their notices still send
mark_running_jobs_interrupted skipped legacy fires without a registered durable owner entirely — correct for the persisted last_status write (no owner fence to protect a replacement run), but the gateway shutdown path also uses the returned ID list to deliver interrupted-cron notices while adapters are still connected (#82232). Keep the persistence skip, but include the job in the returned list so the user is still told.
This commit is contained in:
@@ -957,6 +957,12 @@ def mark_running_jobs_interrupted(
|
||||
"leaving persisted state untouched",
|
||||
job_id,
|
||||
)
|
||||
# Still report the interruption to the caller: the gateway
|
||||
# shutdown path uses the returned IDs to send the
|
||||
# interrupted-cron notice while adapters are still connected
|
||||
# (#82232). The in-memory interrupt flag WAS recorded above —
|
||||
# only the persisted last_status write is skipped here.
|
||||
marked.append(job_id)
|
||||
continue
|
||||
try:
|
||||
with use_cron_store(profile_home):
|
||||
|
||||
@@ -220,10 +220,10 @@ class TestDeliveryErrorIsRecordedWhenTheNoticeCannotBeSent:
|
||||
|
||||
import cron.scheduler as sched
|
||||
|
||||
src = inspect.getsource(sched.run_one_job)
|
||||
src = inspect.getsource(sched._run_one_job_body)
|
||||
assert 'update_job(job["id"], {"last_delivery_error": delivery_error})' in src, (
|
||||
"interrupted runs must still persist the delivery failure"
|
||||
)
|
||||
# The recovery branch hangs off the interrupted-flag short-circuit,
|
||||
# not off a second mark_job_run call.
|
||||
assert "elif delivery_error:" in src
|
||||
assert "if interrupted:" in src and "if delivery_error:" in src
|
||||
|
||||
Reference in New Issue
Block a user