mvniekerk / tokio-cron-scheduler

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

repeated schedule minimum duration #88

Open zainpay opened 1 week ago

mvniekerk commented 1 week ago

Hi Currently yes. This choice was informed by the cron library used. Obviously the faster the scheduler needs to run the more cpu will be used.

Making that value configurable could be an option in the future though.

Groete / Best regards Michael van Niekerk


Van: Zainpay @.> Gestuur: Tuesday, November 12, 2024 1:20:57 PM aan: mvniekerk/tokio-cron-scheduler @.> Aa: Michael van Niekerk @.>; Mention @.> onderwerp: [mvniekerk/tokio-cron-scheduler] repeated schedule minimum duration (Issue #88)

Hello @mvniekerkhttps://github.com/mvniekerk Thanks for this awesome library. I need a bit of clarification on the minimum possible value of the Duration for Job::new_repeated_async function. From the source code it stated that a new job will only be created after the delay of 500ms Create a new async repeated job. This is checked if it is running only after 500ms in 500ms intervals. let mut sched = JobScheduler::new(); let job = Job::new_repeated_async(Duration::from_secs(8), |_uuid, _lock| Box::pin(async move { println!("{:?} I'm repeated every 8 seconds", chrono::Utc::now()); })); sched.add(job) tokio::spawn(sched.start());

Does this mean that we cannot have a repeated scheduler with duration less than 500ms ?

Thanks

— Reply to this email directly, view it on GitHubhttps://github.com/mvniekerk/tokio-cron-scheduler/issues/88, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AAL7O75E45JMHR7NIIYNFFD2AHQBTAVCNFSM6AAAAABRT2DI7WVHI2DSMVQWIX3LMV43ASLTON2WKOZSGY2TCOBXGY2TKNY. You are receiving this because you were mentioned.Message ID: @.***>