Skip to main content

cancel

Function cancel 

Source
pub async fn cancel(
    transaction: &mut Transaction<'_, Postgres>,
    id: Uuid,
    by: &str,
    reason: &str,
) -> Result<bool>
Expand description

Cancel the job id if it is still queued, as an act of by, for reason, kept in axa_job_acts in the caller’s transaction, so that the caller’s own audit row commits with it. Answers whether it was cancelled. A job already claimed runs on: cancelling cannot stop work in progress. A job in any other state, or no such job, changes nothing and writes no act.

The job’s row stays locked until the transaction ends, so keep it short.

§Errors

Fails on a database error, and with Error::NotACode when by or reason is empty, longer than MAX_REASON_CHARS, or has a line break, before anything is written.