Skip to content

Commit

Permalink
Remove the code that double check last run time and current time
Browse files Browse the repository at this point in the history
  • Loading branch information
xwjdsh committed Nov 2, 2022
1 parent 1db6f41 commit 6e0156a
Showing 1 changed file with 0 additions and 6 deletions.
6 changes: 0 additions & 6 deletions scheduler.go
Original file line number Diff line number Diff line change
Expand Up @@ -356,12 +356,6 @@ func (s *Scheduler) calculateDays(job *Job, lastRun time.Time) nextRun {
if job.getInterval() == 1 {
lastRunDayPlusJobAtTime := s.roundToMidnight(lastRun).Add(job.getAtTime(lastRun))

// handle occasional occurrence of job running to quickly / too early such that last run was within a second of now
lastRunUnix, nowUnix := job.LastRun().Unix(), s.now().Unix()
if lastRunUnix == nowUnix || lastRunUnix == nowUnix-1 || lastRunUnix == nowUnix+1 {
lastRun = lastRunDayPlusJobAtTime
}

if shouldRunToday(lastRun, lastRunDayPlusJobAtTime) {
return nextRun{duration: until(lastRun, lastRunDayPlusJobAtTime), dateTime: lastRunDayPlusJobAtTime}
}
Expand Down

0 comments on commit 6e0156a

Please sign in to comment.