Skip to content

Commit

Permalink
FIX cron job disabled flag
Browse files Browse the repository at this point in the history
  • Loading branch information
d-lukutin committed May 12, 2023
1 parent c805c9a commit 1f0d453
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions lib/scheduler.orchestrator.ts
Expand Up @@ -67,11 +67,6 @@ export class SchedulerOrchestrator
const cronKeys = Object.keys(this.cronJobs);
cronKeys.forEach((key) => {
const { options, target } = this.cronJobs[key];

if (options.disabled) {
return;
}

const cronJob = new CronJob(
options.cronTime,
target as any,
Expand All @@ -83,7 +78,13 @@ export class SchedulerOrchestrator
options.utcOffset,
options.unrefTimeout,
);
cronJob.start();

if (options.disabled) {
cronJob.stop();
}
else {
cronJob.start();
}

this.cronJobs[key].ref = cronJob;
this.schedulerRegistry.addCronJob(key, cronJob);
Expand Down

0 comments on commit 1f0d453

Please sign in to comment.