Skip to content

Commit

Permalink
fix: re-add runOnce property
Browse files Browse the repository at this point in the history
  • Loading branch information
sheerlox committed Oct 25, 2023
1 parent 5ff1cf8 commit f06b809
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/job.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ export class CronJob<OC extends CronOnCompleteCommand | null = null, C = null> {
? CronOnCompleteCallback
: undefined;

get runOnce(): boolean {
return this.cronTime.realDate;
}

private _timeout?: NodeJS.Timeout;
private _callbacks: CronCallback<C, WithOnComplete<OC>>[] = [];

Expand Down Expand Up @@ -255,7 +259,7 @@ export class CronJob<OC extends CronOnCompleteCommand | null = null, C = null> {
this.running = false;

// start before calling back so the callbacks have the ability to stop the cron job
if (!this.cronTime.realDate) {
if (!this.runOnce) {
this.start();
}

Expand Down

0 comments on commit f06b809

Please sign in to comment.