arbiter-core-0.1.0.0
arbiter-core
Safe HaskellNone
LanguageGHC2024

Arbiter.Core.Sql.Lifecycle

Description

Lifecycle SQL templates.

Synopsis

Documentation

Source #smartAckJobSQL :: Bool -> Text -> Text -> Int64 -> Int64 -> Query Int64

Parent-aware ack. Deletes a childless job, suspends one whose children are still running, and wakes a suspended parent whose last child left the queue. Returns 1, or 0 for a job gone, reclaimed or cancelled. When archiveEnabled, the deleted row is teed into the archive per-row on archive_for.

Source #smartAckJobsBatchSQL :: Bool -> Text -> Text -> [Int64] -> [Int64] -> Query Int64

Set-based smart ack over unnested (id, claim_seq) arrays. Deletes leaves, suspends finalizers that still have children, and wakes parents whose last child completed. The wake check excludes acked children explicitly. Returns the acked ids. Reclaimed jobs are absent. Locks children-first to match nack and force-cancel. The caller holds the parent locks.

Source #setVisibilityTimeoutSQL :: Text -> Text -> Double -> Int64 -> Int64 -> Query ()

Extend a job's visibility timeout. Matches on the claim token. Suspended rows hold no lease.

Source #setVisibilityTimeoutBatchSQL :: Text -> Text -> Query () -> [Int64] -> Double -> Query ()

setVisibilityTimeoutSQL over a batch, for the heartbeat. Extends every job still under this claim, held by the same worker and unsuspended, and reports per row whether the update landed alongside its claim token, cancel flag and suspension. valuesFrag carries the input (id, claim_seq, claimed_by) rows.

Source #updateJobForRetrySQL :: Text -> Text -> Int64 -> Text -> Int64 -> Int64 -> Query ()

Park a failed job for its retry backoff. Matches on the claim token.

Source #nackJobSQL :: Text -> Text -> Int64 -> Int64 -> Int32 -> Query ()

Soft nack. Releases the claim and hands back the attempt it consumed, recording no failure. Leaves not_visible_until as it stands.

Source #nackJobsBatchSQL :: Text -> Text -> [Int64] -> [Int64] -> [Int32] -> Query Int64

nackJobSQL over unnested (id, claim_seq, attempts) arrays, locking children-first to match ack and force-cancel. Returns the ids nacked.

Source #promoteJobSQL :: Text -> Text -> Int64 -> Query ()

Make a delayed or retrying job immediately visible. Refuses an in-flight job.