Redmage/api/scheduler/delete.go
Tigor Hutasuhut f78661aa6e
Some checks failed
/ push (push) Has been cancelled
scheduler: fix missing default sheduler timeout causing scheduler to
never runs
2024-05-21 22:27:11 +07:00

18 lines
403 B
Go

package scheduler
// Delete removes a job from the scheduler.
//
// If job does not exist, it will be a no-op.
func (scheduler *Scheduler) Delete(subreddit string) {
scheduler.mu.Lock()
defer scheduler.mu.Unlock()
scheduler.delete(subreddit)
}
func (scheduler *Scheduler) delete(subreddit string) {
job := scheduler.get(subreddit, false)
if job != nil {
scheduler.scheduler.Remove(job.ID)
}
}