Skip to main content

Module schedule

Module schedule 

Source
Expand description

The scheduler: cron, expressed as a builder.

ⓘ
let mut schedule = schedule(queue.clone());

schedule.job(SendDailyReport).daily().at("13:00");
schedule.job(PruneSessions).hourly();
schedule.job(SyncInventory).every_minutes(5).without_overlapping();
schedule.job(BillCustomers).weekly_on(Weekday::Monday, "09:00");
schedule.job(RebuildSearchIndex).cron("*/5 * * * *");

schedule.run(shutdown).await?;

Each builder method returns &mut ScheduledEvent, the same shape rustlavel-db’s schema builder uses, so the chain reads as one sentence. A method that is handed something invalid records the complaint on the event rather than returning a Result that would break the chain; the whole set is checked in one go by Scheduler::compile, which run calls first.

Structs§

ScheduledEvent
One entry in a schedule.
Scheduler
A set of scheduled events, and the loop that runs them.
TickReport
What one tick did.

Functions§

schedule
Start building a schedule. The Rust spelling of Laravel’s schedule().