happier del

master
Bel LaPointe 2021-09-28 15:06:53 -06:00
parent 7db42cf5f0
commit 3d6fae2dab
1 changed files with 5 additions and 13 deletions

View File

@ -216,20 +216,12 @@ func (s *Scheduler) Add(j *Job) error {
func (s *Scheduler) Remove(j *Job) error {
logb.Debugf("[sched] rm: %+v", j)
entryID, ok := s.getEntry(j)
if !ok {
return ErrJobNotFound
if entryID, ok := s.getEntry(j); ok {
s.cron.Remove(entryID)
}
was := len(s.cron.Entries())
s.cron.Remove(entryID)
is := len(s.cron.Entries())
if was == is {
return ErrJobNotFound
}
if err := config.Store.Set(j.Name, nil, ns.Jobs...); err != nil {
return err
}
return config.Store.Set(j.Name, nil, ns.JobsRaw...)
config.Store.Set(j.Name, nil, ns.Jobs...)
config.Store.Set(j.Name, nil, ns.JobsRaw...)
return nil
}
func (s *Scheduler) getEntry(j *Job) (cron.EntryID, bool) {