Background maintenance scheduler.
Runs two classes of work on separate cadences: Short interval (maintenance-interval-ms, default 60 s): reset-locked-jobs — frees jobs orphaned by crashed workers refill-rate-limits — refills token buckets whose window has expired
Cron schedule (schedule, default '0 3 * * *'): GC tasks listed in :tasks config (gc-task-identifiers, gc-job-queues, gc-job-history).
The GC schedule is evaluated on each maintenance tick; the first tick after a scheduled time triggers the run. Last-run time is tracked in memory and resets to nil on restart (causing GC to wait for the next scheduled slot).
Background maintenance scheduler.
Runs two classes of work on separate cadences:
Short interval (maintenance-interval-ms, default 60 s):
reset-locked-jobs — frees jobs orphaned by crashed workers
refill-rate-limits — refills token buckets whose window has expired
Cron schedule (schedule, default '0 3 * * *'):
GC tasks listed in :tasks config (gc-task-identifiers, gc-job-queues,
gc-job-history).
The GC schedule is evaluated on each maintenance tick; the first tick
after a scheduled time triggers the run. Last-run time is tracked in memory
and resets to nil on restart (causing GC to wait for the next scheduled slot).(create-scheduler job-system)(create-scheduler job-system config)Creates a maintenance scheduler. Call start! to begin processing. job-system is {:pool datasource :validator validator}. config keys: :maintenance-interval-ms, :schedule, :tasks, :timezone, :retention-periods.
Creates a maintenance scheduler. Call start! to begin processing.
job-system is {:pool datasource :validator validator}.
config keys: :maintenance-interval-ms, :schedule, :tasks, :timezone, :retention-periods.(running? sched)Returns true if the maintenance loop is active.
Returns true if the maintenance loop is active.
(start! sched)Starts the maintenance loop. Throws if already running. Returns scheduler.
Starts the maintenance loop. Throws if already running. Returns scheduler.
(stats sched)Returns a snapshot of maintenance scheduler operational metrics. Keys: :maintenance-runs, :gc-runs, :errors.
Returns a snapshot of maintenance scheduler operational metrics. Keys: :maintenance-runs, :gc-runs, :errors.
(stop! sched)(stop! sched timeout-ms)Signals the loop to stop, interrupts the thread, and joins it. Returns scheduler.
Signals the loop to stop, interrupts the thread, and joins it. Returns scheduler.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |