The schedule is code, and its locks are checked.
Jobs, console commands and closures on a schedule declared in routes/console.rs, run by schedule:work or by cron calling schedule:run.
What you get
- Frequencies from
every_five_minutes()toweekly_on(1, "09:00"). without_overlapping(ttl)andon_one_server()take locks in the cache.- In production the scheduler refuses to start when those locks would be per-process and therefore meaningless.
schedule:listprints what is due and when; a failed task is aScheduledTaskFailedevent.
In the docs
src/routes/console.rs
use rainier_framework::scheduler::Schedule;
pub fn schedule(schedule: &mut Schedule) {
schedule
.job(PruneSessions)
.daily_at("03:00")
.without_overlapping(Duration::from_secs(1800));
schedule.job(SendWeeklyDigest).weekly_on(1, "09:00").on_one_server();
schedule.command(console.clone(), "lookout:prune").daily();
}
// app schedule:work — runs it, refusing to start in production if a
// lock would be per-process and so mean nothing
// app schedule:list — prints it
Up close
Select an image to see it full size.