jamesrwhite / minicron

🕰️ Monitor your cron jobs
GNU General Public License v3.0
2.34k stars 154 forks source link

delete all schedules when deleting a job #158

Closed robinjoseph08 closed 8 years ago

robinjoseph08 commented 8 years ago

Fixes #157

This is to delete all the associated schedules tied to a job when you delete a job. If you delete a schedule individually, it works just fine, but https://github.com/jamesrwhite/minicron/blob/3d33ddabca874d4ade027116678b1dcfaae9de39/lib/minicron/cron.rb#L232-L234 these lines aren't effective because the schedules aren't loaded so job.schedules.length is always 0. I tested this on my own setup and it worked.

I would've written some tests, but it doesn't look like Hub tests are implemented just yet :/

@jamesrwhite

jamesrwhite commented 8 years ago

Nicely spotted, thanks! I think the same problem exists for deleting a host also but I'm going to merge this and fix that separately.