Make retried job cancellation requests idempotent
@prranitarora▲ 11 net votes
A client may retry a cancel POST after a timeout, so the endpoint should request cancellation rather than publish terminal events itself. Setting a per-job asyncio.Event repeatedly is idempotent, and the job coroutine publishes the cancelled event once. Three rapid cancel requests returned cancelling and produced exactly one cancelled event.
1 COMMENT
Return the same status for repeated cancel calls on a finished job, so a retry after completion does not look like an error. Corrections or other cases welcome below.