API
Claim and heartbeat
How workers lease work and extend ownership.
Claim
Workers claim from one or more queues with an optional batch size. Claiming uses FOR UPDATE SKIP LOCKED and stamps:
status = runningcurrent_attempt_idlease_expires_atworker_id
Per-resource concurrency limits (concurrency_key) are enforced at claim with a deadlock-free try-lock admission protocol.
Heartbeat
Heartbeats are pure lease bumps by default. Progress checkpoints are batched onto heartbeats — keep progress small (cursor, not a result set).
On fence loss or repeated transport failures, the worker cancels the handler task immediately.
Soft stop
On SIGTERM: stop claiming → wait soft_stop_timeout (or forever if unset) → hard-cancel handlers → release running work with a shutdown cause.