mvniekerk / tokio-cron-scheduler

Schedule tasks on Tokio using cron-like annotation
Apache License 2.0
453 stars 54 forks source link

Example is out of date #29

Closed inferiorhumanorgans closed 2 years ago

inferiorhumanorgans commented 2 years ago

e.g.

let mut sched = JobScheduler::new();

sched.add(Job::new("1/10 * * * * *", |uuid, l| {
    println!("I run every 10 seconds");
}).unwrap());

JobScheduler::new returns a Result so that won't work.

sched.start().await;

start returns a Result over () and not a future so await won't/can't work.

mvniekerk commented 2 years ago

Thank you @inferiorhumanorgans for the bug report. I've updated the README accordingly and the docs.

inferiorhumanorgans commented 2 years ago

Any thoughts on having start return the JoinHandle instead of () so we can call await on the result?