pub enum Schedule {
Every(Duration),
Cron(String),
}Expand description
When a scheduled pipeline fires.
Variants§
Every(Duration)
A fixed interval between runs.
Cron(String)
A five-field cron expression, evaluated in the Tower’s local time zone.
Implementations§
Source§impl Schedule
impl Schedule
Sourcepub const MIN_INTERVAL_SECS: u64 = 60
pub const MIN_INTERVAL_SECS: u64 = 60
The shortest interval a schedule may declare.
Every firing is a real, paid CLI invocation, and a schedule runs with nobody watching. A
minute is the floor because it is the finest granularity a five-field cron expression can
express, so allowing anything shorter would make every and cron disagree about what is
possible.
Sourcepub fn interval(&self) -> Option<Duration>
pub fn interval(&self) -> Option<Duration>
Returns the fixed interval, if this schedule is one.
Sourcepub fn next_after(&self, now: Timestamp) -> Option<Timestamp>
pub fn next_after(&self, now: Timestamp) -> Option<Timestamp>
The first firing strictly after now.
Both forms are computed from the clock rather than from when the last run finished. Adding an interval to a finish time makes the period drift by however long the work took, so an hourly job slowly becomes a ninety-minute one.
Returns None only for a cron expression that never matches — 31 February, say — which
parses cleanly and is therefore accepted at load. A pipeline that can never fire is better
left silent than made to fire at some arbitrary substitute time.
Sourcepub fn min_gap_secs(&self) -> Option<u64>
pub fn min_gap_secs(&self) -> Option<u64>
Returns a lower bound on the gap between firings, in seconds, when one can be established.
For a fixed interval this is exact. For a cron expression it is read off the minute field,
and only when that field states the answer unambiguously: * fires every minute and
*/n every n minutes. Lists and ranges are left alone rather than guessed at, because a
wrong lower bound here means a warning that is not true, and a validator that cries wolf is
one people stop reading.