Skip to contents

Calls handler(task@input, task) and records its result, or records a handler error as a task failure. Interrupts, lease loss and storage errors propagate instead, and do not use the failure budget. If recording a handler failure also fails, canard_failure_recording_error keeps both conditions; see ca_conditions().

Usage

ca_run(task, handler, failure_delay = 0)

Arguments

task

A claim returned by ca_claim() or passed to an R handler.

handler

Function taking (input, ctx).

failure_delay

Nonnegative seconds before a failed task can be claimed again. This is separate from caller-managed SQL conflict retries.

Value

A list, invisibly, with id, claim attempt, attempt status ("completed", "suspended", or "failed"), persisted task state, stored R result, and original handler error. A failed attempt can leave the task ready for retry or terminally failed. Error text is stored without truncation; the R condition remains available in this outcome.