mvniekerk / tokio-cron-scheduler

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

Remove job funcitonality unusable #1

Closed MrDarthShoe closed 3 years ago

MrDarthShoe commented 3 years ago

Removing job from JobScheduler seems to be unusable. remove function takes Uuid of job which user want to remove:

pub fn remove(&mut self, to_be_removed: &Uuid) -> Result<(), Box<dyn std::error::Error + '_>>

However, it seems that user cannot get Uuid of created job, because it is marked as private outside crate:

pub struct JobLocked(pub(crate) Arc<RwLock<Job>>);

Possible solutions:

mvniekerk commented 3 years ago

Thank you for this report.

I've added the functionality on v0.1.3 and added it to the example, have a look and tell me if it works for you.

mvniekerk commented 3 years ago

BTW, the UUID is added as a parameter into the run closure (1st param) if you want to get the UUID on the run callback.

MrDarthShoe commented 3 years ago

Removing jobs on the fly works now. Thanks!