Skip to content

Commit

Permalink
fix to handle when next ends up in the past
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnRoesler committed Dec 31, 2023
1 parent 73391ef commit 7700a27
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions scheduler.go
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,11 @@ func (s *scheduler) selectExecJobIDsOut(id uuid.UUID) {
if next.IsZero() {
return
}
if next.Before(s.now()) {
for next.Before(s.now()) {
next = j.next(next)
}
}
j.nextRun = next
j.timer = s.clock.AfterFunc(next.Sub(s.now()), func() {
select {
Expand Down

0 comments on commit 7700a27

Please sign in to comment.