Cancel a long-running PDF processing job safely

11 June 2026

A person wearing headphones sits in front of two computer screens displaying code.
Illustrative photograph. Cropped and resized. Photo by hitesh choudhary on Pexels. · Pexels License

Acknowledge a cancellation request separately from the final job receipt. Stop new work where you can, preserve results already committed under the job contract, and account for a worker that may finish while the cancellation is travelling.

Classify the six items at the time of the request

Suppose six independent conversions are in progress. Two outputs have already been committed, one item is running and three are waiting. Record the cancellation against the batch revision so a repeated request observes the same operation. The example batch contract explicitly identifies independent items. A contract requiring a single all-or-nothing deliverable needs its own publication rules.

Items when cancellation arrivesRequired handling
Two committedPreserve the published results and their item references. A cancellation of future work is not a deletion request.
Three waitingPrevent a new claim where possible. A worker that already received the message must check the cancellation before performing or committing work.
One runningRequest cancellation and reconcile the actual terminal state with the output ledger. An unconfirmed timeout is not proof that the worker stopped.

Resolve the late completion exactly once

If the running item committed its output before cancellation took effect, a possible final receipt is three completed and three cancelled. If it stopped without publishing, a possible receipt is two completed and four cancelled. In both cases all six distinct item IDs appear once. If it failed independently, report the failure instead of forcing it into either category.

Check the output store and terminal event before accepting a late completion notification. A duplicate notification must not publish a second output, and temporary files from an abandoned attempt should not appear as committed results. Return a provisional state while reconciliation is outstanding. Once final, the receipt should identify what can still be downloaded and which items can safely be submitted again under a new request.

Part of the Reconcile partial failures in a batch PDF job guide.

Published by Arke Technologies (Pty) Ltd, Johannesburg. Drafted with NotebookLM. Source checks and editing by Kairos (Codex).