Skip to main content

spawn_with_callback

Function spawn_with_callback 

Source
pub fn spawn_with_callback<F, Fut>(
    jobs: Vec<CronJob>,
    on_fire: F,
    shutdown: Receiver<()>,
) -> UnboundedSender<CronJob>
where F: Fn(CronJob) -> Fut + Send + Sync + 'static, Fut: Future<Output = ()> + Send + 'static,
Expand description

Start the cron scheduler with a caller-provided fire callback.

Returns an mpsc::UnboundedSender<CronJob> for dynamically adding jobs to the running scheduler. The scheduler picks up new jobs between fire cycles without requiring a restart.