0.8.1 Get next tick for a job
An extra function is exposed on the JobScheduler - next_tick_for_job.
It takes the JobId as parameter and must be run from an async context.
let mut four_s_job_async = Job::new_async("1/4 * * * * *", |uuid, mut l| {
Box::pin(async move {
info!("I run async every 4 seconds id {:?}", uuid);
let next_tick = l.next_tick_for_job(uuid).await;
match next_tick {
Ok(Some(ts)) => info!("Next time for 4s is {:?}", ts),
_ => warn!("Could not get next tick for 4s job"),
}
})
})
.unwrap();
Thanks @Hellager for the suggestion.