From f06b8090b9b40587de127b99a5a125c2cad50bf3 Mon Sep 17 00:00:00 2001 From: Pierre Cavin Date: Wed, 25 Oct 2023 23:16:41 +0200 Subject: [PATCH] fix: re-add runOnce property --- src/job.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/job.ts b/src/job.ts index 68d7c349..dc799da3 100644 --- a/src/job.ts +++ b/src/job.ts @@ -21,6 +21,10 @@ export class CronJob { ? CronOnCompleteCallback : undefined; + get runOnce(): boolean { + return this.cronTime.realDate; + } + private _timeout?: NodeJS.Timeout; private _callbacks: CronCallback>[] = []; @@ -255,7 +259,7 @@ export class CronJob { 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(); }