Skip to content

feat(controller): support stopping periodic and errored jobs#2131

Open
shiyasmohd wants to merge 1 commit intomainfrom
shiyasmohd/stop-triggers
Open

feat(controller): support stopping periodic and errored jobs#2131
shiyasmohd wants to merge 1 commit intomainfrom
shiyasmohd/stop-triggers

Conversation

@shiyasmohd
Copy link
Copy Markdown
Contributor

Extend the scheduler stop path so periodic jobs parked in terminal states between fires remain stoppable, and one-shot jobs in retryable ERROR can be cancelled before the next retry.

  • Accept Scheduled/Running/Completed/Error/Fatal as stop sources in job_status::request_stop; keep idempotent Ok(false) for StopRequested/Stopping
  • Filter non-periodic Completed/Fatal in Scheduler::stop_job_impl using a new jobs::get_by_id_with_descriptor single-round-trip lookup plus Trigger::from_descriptor periodicity check
  • Emit TriggerCommand::Unregister after a successful stop commit so periodic timers are torn down
  • Refresh stop handler and request_stop docs to reflect the one-shot vs periodic state-transition matrix
  • Add DB-layer tests for stopping from Completed/Error/Fatal and an integration test that forces a one-shot job to ERROR and asserts stop succeeds

Extend the scheduler stop path so periodic jobs parked in terminal states between fires remain stoppable, and one-shot jobs in retryable ERROR can be cancelled before the next retry.

- Accept `Scheduled`/`Running`/`Completed`/`Error`/`Fatal` as stop sources in `job_status::request_stop`; keep idempotent `Ok(false)` for `StopRequested`/`Stopping`
- Filter non-periodic `Completed`/`Fatal` in `Scheduler::stop_job_impl` using a new `jobs::get_by_id_with_descriptor` single-round-trip lookup plus `Trigger::from_descriptor` periodicity check
- Emit `TriggerCommand::Unregister` after a successful stop commit so periodic timers are torn down
- Refresh stop handler and `request_stop` docs to reflect the one-shot vs periodic state-transition matrix
- Add DB-layer tests for stopping from `Completed`/`Error`/`Fatal` and an integration test that forces a one-shot job to `ERROR` and asserts stop succeeds

Signed-off-by: Shiyas Mohammed <shiyasmohd.official@gmail.com>
@shiyasmohd shiyasmohd force-pushed the shiyasmohd/stop-triggers branch from 10f5668 to 1324d7c Compare April 15, 2026 12:59
@shiyasmohd shiyasmohd marked this pull request as ready for review April 15, 2026 13:03
@shiyasmohd shiyasmohd requested a review from LNSD April 15, 2026 13:03
@shiyasmohd shiyasmohd self-assigned this Apr 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant