happier del
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user