Skip to content

Commit

Permalink
fix: fix lastDate() value for intervals > 25 days
Browse files Browse the repository at this point in the history
  • Loading branch information
sheerlox committed Oct 2, 2023
1 parent a885f97 commit 8309b48
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/job.ts
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,6 @@ export class CronJob<OC extends CronOnCompleteCommand<C> | null, C = null> {
// again. This processing might make us miss the deadline by a few ms
// times the number of sleep sessions. Given a MAXDELAY of almost a
// month, this should be no issue.
this.lastExecution = new Date();
if (remaining) {
if (remaining > MAXDELAY) {
remaining -= MAXDELAY;
Expand All @@ -256,6 +255,7 @@ export class CronJob<OC extends CronOnCompleteCommand<C> | null, C = null> {
setCronTimeout(timeout);
} else {
// We have arrived at the correct point in time.
this.lastExecution = new Date();

this.running = false;

Expand Down

0 comments on commit 8309b48

Please sign in to comment.