Liking cljdoc? Tell your friends :D

dev.skivi.scheduler.core

Cron scheduler: evaluates crontab entries and enqueues jobs when due.

Cron state (last_execution) is persisted to known_crontabs so that the scheduler survives process restarts without double-firing. Jobs are enqueued with job_key_mode = unsafe_dedupe, so multiple scheduler instances running in parallel will not produce duplicate queue entries.

The background polling thread evaluates all registered entries on each tick and fires any whose next_run_at <= now. The poll interval is coarse (default 10 s) because cron granularity is one minute.

Relies on the ReadableColumn protocol extensions defined in database.core to return java.time.Instant values for TIMESTAMPTZ columns.

Cron scheduler: evaluates crontab entries and enqueues jobs when due.

Cron state (last_execution) is persisted to known_crontabs so that
the scheduler survives process restarts without double-firing. Jobs are
enqueued with job_key_mode = unsafe_dedupe, so multiple scheduler instances
running in parallel will not produce duplicate queue entries.

The background polling thread evaluates all registered entries on each tick
and fires any whose next_run_at <= now. The poll interval is coarse
(default 10 s) because cron granularity is one minute.

Relies on the ReadableColumn protocol extensions defined in database.core
to return java.time.Instant values for TIMESTAMPTZ columns.
raw docstring

create-schedulerclj

(create-scheduler job-system crontabs emitter)
(create-scheduler job-system crontabs emitter config)

Creates a cron scheduler. Call start! to begin processing. job-system is {:pool datasource :validator validator}. crontabs is a vector of CrontabEntry maps. emitter is a monitoring/Emitter. config keys: :poll-interval-ms, :timezone.

Creates a cron scheduler. Call start! to begin processing.
job-system is {:pool datasource :validator validator}.
crontabs is a vector of CrontabEntry maps.
emitter is a monitoring/Emitter.
config keys: :poll-interval-ms, :timezone.
sourceraw docstring

cron-nextclj

(cron-next schedule base-time timezone)

Returns the next Instant a cron schedule fires after base-time in timezone. Returns nil if the expression has no future occurrence.

Returns the next Instant a cron schedule fires after base-time in timezone.
Returns nil if the expression has no future occurrence.
sourceraw docstring

cron-next-publicclj

(cron-next-public schedule base-time timezone)

Returns the next Instant a cron schedule fires after base-time in timezone. Returns nil if the expression has no future occurrence.

Returns the next Instant a cron schedule fires after base-time in timezone.
Returns nil if the expression has no future occurrence.
sourceraw docstring

fire-due-jobs!clj

(fire-due-jobs! scheduler)

Evaluates all crontab entries and fires any whose next_run_at <= now. Returns a map with :fired (enqueued count) and :skipped (not-due count).

Evaluates all crontab entries and fires any whose next_run_at <= now.
Returns a map with :fired (enqueued count) and :skipped (not-due count).
sourceraw docstring

running?clj

(running? scheduler)

Returns true if the polling loop is active.

Returns true if the polling loop is active.
sourceraw docstring

start!clj

(start! scheduler)

Upserts crontab records then starts the polling loop. Throws if already running. Returns scheduler.

Upserts crontab records then starts the polling loop. Throws if already running.
Returns scheduler.
sourceraw docstring

statsclj

(stats scheduler)

Returns a snapshot of scheduler operational metrics. Keys: :fired, :errors.

Returns a snapshot of scheduler operational metrics.
Keys: :fired, :errors.
sourceraw docstring

stop!clj

(stop! scheduler)
(stop! scheduler timeout-ms)

Signals the polling loop to stop, interrupts the thread, and joins it. Returns scheduler.

Signals the polling loop to stop, interrupts the thread, and joins it.
Returns scheduler.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close