Skip to content

Commit

Permalink
chore(job-scheduler): make sure offset is never negative
Browse files Browse the repository at this point in the history
  • Loading branch information
manast committed Dec 12, 2024
1 parent efcec87 commit c6d2c28
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/classes/job-scheduler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,9 @@ export class JobScheduler extends QueueBase {
} else {
nextMillis = now;
newOffset = every - (nextSlot - now);

// newOffset should always be positive, but as an extra safety check
newOffset = newOffset < 0 ? 0 : newOffset;
}

if (nextMillis < now) {
Expand Down

0 comments on commit c6d2c28

Please sign in to comment.