We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1284df4 commit a61d8c9Copy full SHA for a61d8c9
src/job.ts
@@ -21,6 +21,10 @@ export class CronJob<OC extends CronOnCompleteCommand | null = null, C = null> {
21
? CronOnCompleteCallback
22
: undefined;
23
24
+ get runOnce(): boolean {
25
+ return this.cronTime.realDate;
26
+ }
27
+
28
private _timeout?: NodeJS.Timeout;
29
private _callbacks: CronCallback<C, WithOnComplete<OC>>[] = [];
30
@@ -255,7 +259,7 @@ export class CronJob<OC extends CronOnCompleteCommand | null = null, C = null> {
255
259
this.running = false;
256
260
257
261
// start before calling back so the callbacks have the ability to stop the cron job
258
- if (!this.cronTime.realDate) {
262
+ if (!this.runOnce) {
263
this.start();
264
}
265
0 commit comments