sched: remediate R4 ownership, identity-match, dispatch-mark, and pending atomicity

This commit is contained in:
lda
2026-09-08 10:51:20 +07:00 Verified
parent f1dbe54f61
commit 5be3f82253
4 changed files with 83 additions and 21 deletions
+14 -1
View File
@@ -310,8 +310,21 @@ class Scheduler:
self.schedule_store.save_consumed(sched.id, intended)
from wf_api.run_lifecycle import materialize_admitted_view
# Dispatch mark precedes the view so a crash after admission but
# before/during first dispatch stays pending (not abandoned). Cleared
# after dispatch returns regardless of outcome (hang still dispatched).
try:
self.run_store.mark_pending_dispatch(run_id)
except AttributeError:
pass
materialize_admitted_view(store=self.run_store, admission=admission)
self._dispatch(run_id, now)
try:
self._dispatch(run_id, now)
finally:
try:
self.run_store.clear_pending_dispatch(run_id)
except AttributeError:
pass
return run_id
def _dispatch(self, run_id: str, now: datetime) -> None: