Skip to main content

Module schedule

Module schedule 

Source
Expand description

When is this trigger next due?

Interval, cron and one-shot are three declarations of one primitive: a function from “when did it last fire” to “when should it fire next”. They are kept apart in the vocabulary because they read differently to a person, not because the evaluator treats them differently.

Two behaviours here are worth stating because they are the ones people get wrong:

Rate drifts; cron does not. interval_secs anchors to the last firing, so a 3-minute job on a 5-minute interval leaves a 2-minute gap and the effective period depends on runtime. */5 * * * * anchors to wall-clock boundaries and does not. Both are correct; users need to know which they chose, so the two are separate kinds rather than one field with a flag.

Catch-up collapses by default. A laptop closed over a weekend has missed hundreds of occurrences. Catchup::Last fires once on resume, which is what anacron does and what systemd’s Persistent=true means. All replays them and None drops them; the three-way is Quartz’s misfire vocabulary — fire once now / skip / replay all.

Functions§

advance_after_firing
Where to set next_due_at after a firing that happened at fired_at_ms, given that it is now now_ms.
backoff_until
Back off next_due_at after a failure, so a broken connector does not hot-loop against a source that is down.
exhausts_after
Whether this trigger can never fire again after a firing at fired_at_ms.
initial_due
When a never-evaluated trigger first becomes due.
is_due
Is this trigger due at now_ms?
next_due_after
The next instant at or after after_ms at which trigger should fire.
validate
Parse and validate a declaration’s schedule without evaluating it.