arbiter-core-0.1.0.0
arbiter-core
Safe HaskellNone
LanguageGHC2024

Arbiter.Core.Sql.Cron

Description

Cron SQL templates.

Synopsis

Documentation

Source #allCronColumns :: Text

The cron_schedules read columns, in codec order.

Source #upsertCronDefaultSQL :: Text -> Text -> Text -> Text -> Text -> Maybe Text -> Query ()

Upsert a cron schedule's default values, preserving override_* columns on conflict. An unchanged schedule is left alone.

Source #listCronSchedulesSQL :: Text -> Maybe Text -> Query CronScheduleRow

List cron schedules ordered by name, optionally filtered by queue.

Source #getCronScheduleByNameSQL :: Text -> Text -> Query CronScheduleRow

Get a single cron schedule by name.

Source #updateCronScheduleSQL :: Text -> Text -> CronScheduleUpdate -> Maybe (Query ())

Patch a cron schedule's overrides. Nothing when the patch sets no column. Just Nothing clears an override. Disabling also drops a pending run request.

Source #touchCronLastFiredSQL :: Text -> Text -> Query ()

Set last_fired_at to NOW() for a schedule.

Source #touchCronCheckedSQL :: Text -> UTCTime -> [Text] -> Query ()

Set last_checked_at to the caller-supplied watermark for the given schedule names. The watermark is the minute boundary the scheduler finished evaluating. GREATEST keeps it from moving backward under concurrent worker pools with skewed clocks.

Source #tryFireCronGateSQL :: Text -> UTCTime -> Text -> Query ()

Fire-once-per-minute gate. Advances last_fired_at to the minute floor when the existing value is less. Zero rows means another pool won.

Source #tryAcquireCronLeaderSQL :: Text -> Text -> Text -> Query Bool

Per-(schema, queue, name) transaction-scoped advisory lock for cron.

Source #requestCronRunSQL :: Text -> Text -> Query Text

Stamp a run request on an enabled schedule and NOTIFY, returning a status.

Source #claimCronRunSQL :: Text -> Text -> Query CronScheduleRow

Claim a pending run request, clearing the flag and returning the claimed row.

Source #touchCronManualRunSQL :: Text -> UTCTime -> Text -> Query ()

Record when a manual run last fired a job.

Source #pendingCronRunsSQL :: Text -> [Text] -> Query Text

Names of enabled schedules with a pending run request among the given names.