mirror of
https://github.com/microsoft/BCQuality.git
synced 2026-10-06 07:06:54 +01:00
# Conflicts: # microsoft/knowledge/performance/job-queue-category-code-serializes-conflicting-jobs.bad.al # microsoft/knowledge/performance/job-queue-category-code-serializes-conflicting-jobs.good.al # microsoft/knowledge/performance/job-queue-category-code-serializes-conflicting-jobs.md # microsoft/knowledge/performance/job-queue-external-effects-must-be-idempotent.bad.al # microsoft/knowledge/performance/job-queue-external-effects-must-be-idempotent.good.al # microsoft/knowledge/performance/job-queue-external-effects-must-be-idempotent.md # microsoft/knowledge/performance/job-queue-handlers-must-not-require-ui.bad.al # microsoft/knowledge/performance/job-queue-handlers-must-not-require-ui.good.al # microsoft/knowledge/performance/job-queue-handlers-must-not-require-ui.md # microsoft/knowledge/performance/job-queue-handlers-must-propagate-failures.bad.al # microsoft/knowledge/performance/job-queue-handlers-must-propagate-failures.good.al # microsoft/knowledge/performance/job-queue-handlers-must-propagate-failures.md # microsoft/knowledge/performance/job-queue-on-hold-does-not-stop-running-work.bad.al # microsoft/knowledge/performance/job-queue-on-hold-does-not-stop-running-work.good.al # microsoft/knowledge/performance/job-queue-on-hold-does-not-stop-running-work.md # microsoft/knowledge/performance/store-scheduled-task-id-to-avoid-duplicate-tasks.bad.al # microsoft/knowledge/performance/store-scheduled-task-id-to-avoid-duplicate-tasks.good.al # microsoft/knowledge/performance/store-scheduled-task-id-to-avoid-duplicate-tasks.md
28 lines
No EOL
1.4 KiB
Markdown
28 lines
No EOL
1.4 KiB
Markdown
---
|
|
bc-version: [all]
|
|
domain: performance
|
|
keywords: [job-queue, on-hold, cancellation, in-process, long-running, stop-request]
|
|
technologies: [al]
|
|
countries: [w1]
|
|
application-area: [all]
|
|
---
|
|
|
|
# Putting a job queue entry on hold does not stop its current run
|
|
|
|
> Contributions welcome — open a PR to refine or extend this article.
|
|
|
|
## Description
|
|
|
|
The On Hold status prevents a job queue entry from starting again, but it does not cancel a run that is already in process. A long-running handler continues until it completes, fails, reaches a cancellation point implemented by the application, or its session is stopped externally.
|
|
|
|
## Best Practice
|
|
|
|
Use On Hold to pause future scheduling. When a long-running operation must support graceful cancellation, store a separate application-owned stop request and check it between bounded units of work. Exit only at a point where completed work and the checkpoint are consistent; use administrative session termination only when graceful cancellation is impossible.
|
|
|
|
See sample: `job-queue-on-hold-does-not-stop-running-work.good.al`.
|
|
|
|
## Anti Pattern
|
|
|
|
Polling the job queue entry's Status field from inside its handler and expecting a change to On Hold to cancel the active run. The status controls scheduling, not cooperative cancellation, so the handler can continue processing despite the operator's action.
|
|
|
|
See sample: `job-queue-on-hold-does-not-stop-running-work.bad.al`. |