pub struct Recurring<P> { /* private fields */ }Expand description
A recurring (cron) schedule.
Implementations§
Source§impl<P> Recurring<P>
impl<P> Recurring<P>
Sourcepub fn new(
name: impl Into<Arc<str>>,
cron: impl Into<Arc<str>>,
template: Task<P>,
) -> Self
pub fn new( name: impl Into<Arc<str>>, cron: impl Into<Arc<str>>, template: Task<P>, ) -> Self
cron accepts 5 fields, or 6 with leading seconds.
The template supplies payload, pool, kind, priority, resources, retry, timeout and tags for every occurrence, and optionally:
- a relative deadline (
Task::deadline_in): each occurrence’s deadline is that long after its start; - a start tolerance and miss policy (
Task::start_tolerance,Task::on_miss), as defaults forRecurring::toleranceandRecurring::on_miss; - a key: a prefix; each occurrence gets
"<key>@<start in UTC, RFC 3339>", e.g.nightly@2026-10-22T03:00:00Z, so occurrences can be looked up and are not created twice.
Absolute deadlines, fixed starts and dependencies describe a single task and are
rejected by Scheduler::add_recurring; to run
occurrences one after another, use OverlapPolicy::Queue. Each occurrence starts at
its cron time with Recurring::tolerance and Recurring::on_miss.
Sourcepub fn tz(self, tz: impl Into<Arc<str>>) -> Self
pub fn tz(self, tz: impl Into<Arc<str>>) -> Self
IANA time zone, e.g. Europe/Lisbon (default UTC).
Sourcepub fn overlap(self, o: OverlapPolicy) -> Self
pub fn overlap(self, o: OverlapPolicy) -> Self
What happens while the previous occurrence is still live: skip (default), allow overlap,
or queue behind it (OverlapPolicy::Queue, OverlapPolicy::QueueOnSuccess).
Sourcepub fn tolerance(self, d: Duration) -> Self
pub fn tolerance(self, d: Duration) -> Self
How late an occurrence may start and still count as on time.
Sourcepub fn on_miss(self, p: MissPolicy) -> Self
pub fn on_miss(self, p: MissPolicy) -> Self
What to do with an occurrence that missed its start.