Redmage/api/scheduler/delete.go

18 lines
403 B
Go
Raw Permalink Normal View History

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)
2024-05-14 18:49:45 +07:00
}
func (scheduler *Scheduler) delete(subreddit string) {
2024-05-14 18:49:45 +07:00
job := scheduler.get(subreddit, false)
if job != nil {
scheduler.scheduler.Remove(job.ID)
}
}