Closed PaulDotSH closed 2 years ago
Hi, the examples from the README are outdated. Replacing the sched init line with this
let mut sched = JobScheduler::new().await.unwrap();
Lets us compile the code, however the behavior isn't expected, the program exits instead of waiting
Example code
let mut sched = JobScheduler::new().await.expect("mata"); let jja = Job::new_repeated_async(Duration::from_secs(7), |_uuid, _l| Box::pin(async move { println!("{:?} I'm repeated async every 7 seconds", chrono::Utc::now()); })).unwrap(); sched.add(jja).await; #[cfg(feature = "signal")] sched.shutdown_on_ctrl_c(); sched.set_shutdown_handler(Box::new(|| { Box::pin(async move { println!("Shut down done"); }) })); sched.start().await;
Yes you're right it won't wait.
Updated. Thanks @PaulDotSH for the suggestion!
Hi, the examples from the README are outdated. Replacing the sched init line with this
Lets us compile the code, however the behavior isn't expected, the program exits instead of waiting
Example code