Skip to main content

Module job_scheduler

Module job_scheduler 

Source
Expand description

§Job Scheduler

Cron-like job scheduler supporting interval, one-shot, and wall-clock cron scheduling with async handlers.

§Example

use std::time::Duration;
use tokio_prompt_orchestrator::job_scheduler::{Schedule, Scheduler};

let scheduler = Scheduler::new();
let id = scheduler.schedule("my-job", Schedule::Interval(Duration::from_secs(60)), || {
    Box::pin(async { println!("tick!"); })
});
// scheduler.start(); // spawns background loop

Structs§

Job
Metadata and scheduling state for a registered job.
JobId
Opaque, unique identifier for a registered Job.
JobStats
A snapshot of job scheduling statistics.
Scheduler
Async job scheduler with interval, one-shot, and cron-style scheduling.

Enums§

Schedule
Defines when a Job should fire.

Type Aliases§

JobHandler
Type alias for an async job handler that can be cloned and sent across threads.