Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not ignore preventOverrun in CronJob #202

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/engines/cron/CronJob.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

constructor(schedule: CronSchedule, task: Task | AsyncTask, options: JobOptions = {}) {
super(options.id)
this.preventOverrun = false
this.preventOverrun = options.preventOverrun || false
this.schedule = schedule
this.task = task
}
Expand All @@ -50,20 +50,21 @@
} catch (err) {
/* istanbul ignore next */
throw new Error(
'Please install "croner" (run "npm i croner") in case you want to use Cron jobs.'

Check failure on line 53 in lib/engines/cron/CronJob.ts

View workflow job for this annotation

GitHub Actions / linting (20.x)

Insert `,`
)
}

this.cronInstance = croner.Cron(
this.schedule.cronExpression,
{
protect: this.preventOverrun,
timezone: this.schedule.timezone,
},
() => {
if (!this.task.isExecuting || !this.preventOverrun) {
this.task.execute(this.id)
}
}

Check failure on line 67 in lib/engines/cron/CronJob.ts

View workflow job for this annotation

GitHub Actions / linting (20.x)

Insert `,`
)
}

Expand Down
Loading