JoobQ::InFlight
The jobs this process has claimed and not finished, with the queue each came from, so JoobQ.shutdown can
let them finish and, at its deadline, put the rest back on their queues.
A claim is identified by a token, not by the job's raw string (two claims of the same string must not
collide). It is claimed from the moment its worker got the job from Redis (before any fiber exists for it),
running once its fiber began, settling while the fiber applies the outcome of a failure (scheduling a retry,
dead-lettering) and abandoned when shutdown gave up on it and returned it to its queue.
An abandoned execution must be inert: its fiber must not start the job (if it has not yet), must not touch the
processing list when it ends (another process may have claimed the job since), and none of its failure or
success handling may schedule, dead-letter, count or announce anything, because the requeued copy owns the
job now. The handling asks settle before its first side effect: the answer and the move to settling are
one step under the lock, so shutdown either abandoned the job before (the handling does nothing) or finds it
settling and waits for it instead of requeuing it while a retry is being scheduled.
Class methods
Marks the claimed and running jobs abandoned and returns them as {queue, job}. Jobs that are settling are
left alone (they are applying a failure outcome and finish in a moment), unless settling is true: the last
resort at the deadline, when their side effects may already be done.
Whether the job being executed by the current fiber was abandoned by shutdown. Read only, and cheap enough for the hot path: false without taking a lock until some job has been abandoned.
Specs only: called, outside the lock, right after a fiber moved to settling.
The claim's fiber begins (the current fiber is remembered for settle and abandoned?). False when
shutdown abandoned the claim first: do not run the job.
Registers freshly claimed jobs, one token each in the order given. Call it as soon as the claim returns.
The claim's fiber ends. True when shutdown had abandoned it (the job is already back on its queue: leave the processing list alone).
Called by the failure handling of the current fiber's job before its first side effect. True: go ahead (the
job is now settling, shutdown waits for it rather than abandoning it). False: shutdown abandoned this
execution, so do nothing. True as well for a fiber that is not running a claimed job.
Waits until no job is claimed, running or settling, or timeout passes. True when the process went quiet.