pub async fn claim_loop(state: ServerState, shutdown: CancellationToken)Available on crate feature
serve only.Expand description
Background claim + cancel-propagation loop (cluster mode only). Each wake:
- fire local cancels for any of this instance’s runs flagged remotely;
- claim up to
available_permits()Pending runs and dispatch each to the existing execution path.
Wakes every poll interval or immediately on a kick() from submit.
Safe to claim exactly available_permits(): in cluster mode this loop is the
SOLE consumer of the execution semaphore (submit writes Pending + kicks but
never spawns locally), so claimed runs queue on the semaphore and drain at
max_concurrent — never over-running local capacity. Claimed runs flip to
Running in the shared DB immediately (the lease keeps them owned) even while
locally queued on the semaphore.