| Safe Haskell | None |
|---|---|
| Language | GHC2024 |
Arbiter.Core.Sql.Lifecycle
Description
Internal to the arbiter packages. Not covered by the PVP.
Lifecycle SQL templates.
Synopsis
- smartAckJobSQL :: Bool -> SchemaName -> TableName -> Int64 -> Int64 -> Query Int64
- smartAckJobsBatchSQL :: Bool -> SchemaName -> TableName -> [Int64] -> [Int64] -> Query Int64
- setVisibilityTimeoutSQL :: SchemaName -> TableName -> Double -> Int64 -> Int64 -> Query ()
- setVisibilityTimeoutBatchSQL :: SchemaName -> TableName -> [JobRead payload] -> Double -> Query ()
- updateJobForRetrySQL :: SchemaName -> TableName -> Int64 -> Text -> Int64 -> Int64 -> Query ()
- nackJobSQL :: SchemaName -> TableName -> Maybe Int64 -> Int64 -> Int64 -> Int32 -> Query ()
- nackJobsBatchSQL :: SchemaName -> TableName -> Maybe Int64 -> [Int64] -> [Int64] -> [Int32] -> Query Int64
- promoteJobSQL :: SchemaName -> TableName -> Int64 -> Query ()
- rescheduleJobSQL :: SchemaName -> TableName -> Int64 -> UTCTime -> Query ()
Documentation
smartAckJobSQL :: Bool -> SchemaName -> TableName -> Int64 -> Int64 -> Query Int64Source #
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.
smartAckJobsBatchSQL :: Bool -> SchemaName -> TableName -> [Int64] -> [Int64] -> Query Int64Source #
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
ids acked or suspended. Gone or reclaimed jobs are absent. Locks rows in descending id order.
The caller holds the parent locks.
setVisibilityTimeoutSQL :: SchemaName -> TableName -> Double -> Int64 -> Int64 -> Query ()Source #
Extend a job's visibility timeout. Matches on the claim token and does not check
the holder. Suspended rows hold no lease. secs at or below 0 clears the lease.
setVisibilityTimeoutBatchSQL :: SchemaName -> TableName -> [JobRead payload] -> Double -> Query ()Source #
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, holder, cancel flag and suspension.
secs at or below 0 clears the lease. The statement never waits on a lock. It takes
the group summaries first, then the rows, both with SKIP LOCKED, and a row whose
summary or row is busy reads back unchanged. The caller attaches the row decoder.
updateJobForRetrySQL :: SchemaName -> TableName -> Int64 -> Text -> Int64 -> Int64 -> Query ()Source #
Park a failed job for its retry backoff. Matches on the claim token.
nackJobSQL :: SchemaName -> TableName -> Maybe Int64 -> Int64 -> Int64 -> Int32 -> Query ()Source #
Soft nack. Releases the claim and hands back the attempt it consumed, recording no
failure. A delay in seconds parks the job for that long. Without one,
not_visible_until stands.
nackJobsBatchSQL :: SchemaName -> TableName -> Maybe Int64 -> [Int64] -> [Int64] -> [Int32] -> Query Int64Source #
nackJobSQL over unnested (id, claim_seq, attempts) arrays. Locks rows in
descending id order. Returns the ids nacked.
promoteJobSQL :: SchemaName -> TableName -> Int64 -> Query ()Source #
Make a delayed or retrying job immediately visible. Refuses an in-flight or suspended job.
rescheduleJobSQL :: SchemaName -> TableName -> Int64 -> UTCTime -> Query ()Source #
Set when a job next becomes visible, clear its throttle marker and void a lapsed claim. Refuses an in-flight, suspended, force-cancel-flagged or exhausted job.