Rustango docs

Schedule a periodic task

Problem

You need to run a cleanup job every hour without an external cron.

Register the task with the in-process Scheduler; each tick runs on the runtime with panic isolation per task.

let mut scheduler = Scheduler::new();
scheduler.add("0 * * * *", || async {
    prune_expired_sessions(&pool).await.ok();
});
scheduler.run();   // spawns onto the Tokio runtime
For heavy/durable work, hand the task to the job queue instead