Method RequeueAsync
- Namespace
- Millrace
- Assembly
- Millrace.dll
RequeueAsync(JobId, CancellationToken)
Runs a finished job again, as a new job carrying a link back to it. Returns the new id, or
null if id does not exist.
public ValueTask<JobId?> RequeueAsync(JobId id, CancellationToken ct = default)
Parameters
idJobIdctCancellationToken
Returns
Remarks
A new job, not a revived one (ยง11.19). Every other part of the contract treats a terminal record as immutable, and rewriting one to make it runnable again would break that for the sake of a single operator action. The new job records RequeuedFrom so the two ends stay visible to each other.
Three consequences fall out rather than being chosen: the retry budget starts fresh because the job is new; the idempotency key is carried, so if another active job already holds it the existing enqueue semantics make this a no-op returning that job's id; and the original's continuations are not revived, because they were cancelled when it died and nothing about a new job resurrects them.
Requeueing a job that is still running is refused โ that is what CancelAsync(JobId, CancellationToken) is for.
Exceptions
- InvalidOperationException
The job has not finished โ it is still scheduled, queued or running. Requeueing it would duplicate work that is already in flight, and the caller who wanted it stopped wanted CancelAsync(JobId, CancellationToken). Failed is allowed alongside the terminal states: a job waiting out a retry has finished an attempt, not its life.