Expand description
Scheduling — the tasks and commands that need more than the scheduler crate depends on.
rainier-scheduler knows about the container and the cache and nothing
else, which is what keeps it usable without a queue or a console. The two
things people actually schedule — a queued job and a console command — are
adapters, and they live here because this is the crate that has both.
ⓘ
// src/routes/console.rs
pub fn schedule(schedule: &mut Schedule) {
schedule.job(PruneSessions).daily_at("03:00").without_overlapping(HALF_HOUR);
schedule.command("app:seed").weekly_on(1, "04:00").on_one_server();
schedule.call("heartbeat", |_| Box::pin(async { Ok(()) })).every_five_minutes();
}Structs§
- Command
Task - A
Taskthat runs a console command. - JobTask
- A
Taskthat dispatches a queued job. - Schedule
List Command schedule:list— what is scheduled, and when it next runs.- Schedule
RunCommand schedule:run— run whatever is due this minute, then exit.- Schedule
Work Command schedule:work— the same thing in a loop, for a container.
Traits§
- Schedule
Ext jobandcommand, on top ofSchedule.
Functions§
- assert_
locks_ are_ shared - Refuse to run a schedule whose locking is decoration.
- warn_
if_ locks_ are_ not_ shared - Say so at boot, in any environment, and carry on.