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() to weekly_on(1, "09:00").
  • without_overlapping(ttl) and on_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:list prints what is due and when; a failed task is a ScheduledTaskFailed event.

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.

Tasks are closures with guards: without_overlapping takes a lock, on_one_server makes sure only one machine runs it.
The framework checks its own guarantees: a lock that only holds within one process is reported at boot, naming the tasks that rely on it.
All features

Type to search 2.0.0 docs.