Takes the next eligible task in queue under a lease. Expired leases are
reclaimable until the failure budget runs out. Claims use optimistic DuckDB
transactions, so callers outside ca_work() handle canard_retryable
themselves; see ca_conditions(). No transaction is held while a handler runs.
Usage
ca_claim(
db,
queue = "default",
worker = paste0("R-", Sys.getpid()),
lease_seconds = 30,
task_names = NULL,
reap_limit = 64L
)Arguments
- db
A handle returned by
ca_open(),ca_serve(), orca_connect().- queue
Queue name.
- worker
Worker label used for inspection; lease tokens establish ownership.
- lease_seconds
Positive lease duration in seconds. Long-running handlers must explicitly heartbeat before this interval expires.
- task_names
Optional character vector of handler names this worker supports.
- reap_limit
Maximum exhausted, expired leases to mark failed before each claim. Batching bounds contention with other workers; it does not limit recovery of leases that still have failure budget.