Skip to main content

resolve_callback_in_tx

Function resolve_callback_in_tx 

Source
pub async fn resolve_callback_in_tx(
    tx: &mut Transaction<'_, Postgres>,
    callback_id: Uuid,
    payload: Option<Value>,
    default_action: DefaultAction,
    run_lease: Option<i64>,
) -> Result<ResolveOutcome, AwaError>
Expand description

Transaction-aware variant of resolve_callback (ADR-029).

Performs callback lookup, CEL evaluation, and the chosen state transition (Complete / Fail / Ignore) inside the caller-owned transaction. The lookup takes a row lock — SELECT ... FOR UPDATE on awa.jobs_hot for canonical storage; FOR UPDATE OF lease against the active queue-storage leases table — so concurrent resolves are serialised on the same callback_id.

Callers that want to dispatch ADR-029 follow-up specs in the same transaction (e.g. Client::resolve_callback) drive this directly, then dispatch specs against the returned ResolveOutcome before committing.