mvniekerk / tokio-cron-scheduler

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

Make channel capacity configurable #58

Closed vsavovski closed 3 months ago

vsavovski commented 10 months ago

Is there any particular reason why channel capacity is limited to 200?

I have a use case where I need to schedule huge amount of jobs, which should be executed asap, and then I get RecvError::Lagged(10) since the channel capacity is quickly filled. I can bypass this if I limit the scheduling to around 200 jobs per go.

I guess it would be nice feature if this can become configurable.

mvniekerk commented 3 months ago

Hi @vsavovski Thank you for reporting. For 0.11.0, I've added JobScheduler::new_with_channel_size(channel_size: usize) -> Result<Self, JobSchedulerError>. For the offensive breaking of the scheduler, I've removed the breaking of the loop if it is not RecvError::Closed.