Liking cljdoc? Tell your friends :D

chime.scheduler

A higher-level scheduler construct built on top of chime.schedule/chime-at & clojure.core/agent. Remembers actively scheduled jobs, until they finish, or are manually cancelled.

A higher-level scheduler construct built on top of `chime.schedule/chime-at` & `clojure.core/agent`.
Remembers actively scheduled jobs, until they finish, or are manually cancelled.
raw docstring

chiming-agentclj

(chiming-agent)
(chiming-agent {:keys [error-handler on-finished on-aborted thread-factory]
                :or {error-handler c/default-error-handler}})

Returns an agent dressed up as a scheduler. Can be configured with an :error-handler (2args - job-id/error), and :on-finished (1arg - job-id) callback. The state of the agent is a map from job-id => chime-return, and it will grow/shrink as jobs are scheduled/un-scheduled (or finished). Use it as the first argument to all functions in this namespace.

Returns an `agent` dressed up as a scheduler.
Can be configured with an :error-handler (2args - job-id/error), and
:on-finished (1arg - job-id) callback. The state of the agent is
a map from job-id => chime-return, and it will grow/shrink
as jobs are scheduled/un-scheduled (or finished). Use it
as the first argument to all functions in this namespace.
sourceraw docstring

schedule!clj

(schedule! scheduler id->job)

Given a <scheduler> and map from ids => [job-fn times-fn], registers each job-fn (1-arg - the time) to be run per the outcome of times-fn (no-arg).

Given a <scheduler> and map from ids => [job-fn times-fn],
registers each job-fn (1-arg - the time) to be run per the
outcome of times-fn (no-arg).
sourceraw docstring

scheduled-idsclj

(scheduled-ids scheduler)

Returns the ids of all the ongoing jobs of this <scheduler>, or nil if there aren't any.

Returns the ids of all the ongoing jobs of this <scheduler>,
or nil if there aren't any.
sourceraw docstring

unschedule!clj

(unschedule! scheduler)
(unschedule! scheduler ids)
(unschedule! scheduler dlay-millis ids)

Given a <scheduler>, gracefully un-schedules (per chime.schedule/shutdown!) the jobs referred to by <ids>. Triggers the :on-aborted handler (if present) otherwise the :on-finished one (see scheduler ctor).

Given a <scheduler>, gracefully un-schedules (per `chime.schedule/shutdown!`)
the jobs referred to by <ids>. Triggers the `:on-aborted` handler (if present)
otherwise the `:on-finished` one (see `scheduler` ctor).
sourceraw docstring

unschedule-now!clj

(unschedule-now! scheduler)
(unschedule-now! scheduler ids)
(unschedule-now! scheduler dlay-millis ids)

Like unschedule!, but uses chime.schedule/shutdown-now!.

Like `unschedule!`, but uses `chime.schedule/shutdown-now!`.
sourceraw docstring

until-next-chimeclj

(until-next-chime scheduler)

Returns a java.time.Duration representing the (time) distance from now (inclusive) until the next chime (exclusive) on this <scheduler>.

Returns a `java.time.Duration` representing the (time) distance
from now (inclusive) until the next chime (exclusive) on this <scheduler>.
sourceraw docstring

upcoming-chime-atclj

(upcoming-chime-at scheduler id)

Returns the next ZonedDateTime object when the job with <id> will chime.

Returns the next `ZonedDateTime` object
when the job with <id> will chime.
sourceraw docstring

upcoming-chimes-atclj

(upcoming-chimes-at scheduler)

Returns a map from job-id => ZonedDateTime.

Returns a map from job-id => ZonedDateTime.
sourceraw docstring

with-deref*cljmacro

(with-deref* a)
source

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close