Merge pull request #11462 from backstage/renovate/cron-2.x

fix(deps): update dependency cron to v2
This commit is contained in:
Ben Lambert
2022-05-30 14:16:30 +02:00
committed by GitHub
5 changed files with 30 additions and 25 deletions
+2 -2
View File
@@ -38,7 +38,7 @@
"@backstage/errors": "^1.0.0",
"@backstage/types": "^1.0.0",
"@types/luxon": "^2.0.4",
"cron": "^1.8.2",
"cron": "^2.0.0",
"knex": "^1.0.2",
"lodash": "^4.17.21",
"luxon": "^2.0.2",
@@ -50,7 +50,7 @@
"devDependencies": {
"@backstage/backend-test-utils": "^0.1.25-next.0",
"@backstage/cli": "^0.17.2-next.0",
"@types/cron": "^1.7.3",
"@types/cron": "^2.0.0",
"wait-for-expect": "^3.0.2"
},
"files": [
@@ -123,7 +123,7 @@ export class LocalTaskWorker {
let dt: number;
if (isCron) {
const nextRun = +new CronTime(settings.cadence).sendAt().toDate();
const nextRun = +new CronTime(settings.cadence).sendAt().toJSDate();
dt = nextRun - Date.now();
} else {
dt =
@@ -175,8 +175,9 @@ export class TaskWorker {
} else if (isCron) {
const time = new CronTime(settings.cadence)
.sendAt()
.add({ seconds: -1 }) // immediately, if "* * * * * *"
.toISOString();
.minus({ seconds: 1 }) // immediately, if "* * * * * *"
.toUTC()
.toISO();
startAt = this.knex.client.config.client.includes('sqlite3')
? this.knex.raw('datetime(?)', [time])
: this.knex.raw(`?`, [time]);
@@ -279,7 +280,7 @@ export class TaskWorker {
let nextRun: Knex.Raw;
if (isCron) {
const time = new CronTime(settings.cadence).sendAt().toISOString();
const time = new CronTime(settings.cadence).sendAt().toUTC().toISO();
this.logger.debug(`task: ${this.taskId} will next occur around ${time}`);
nextRun = this.knex.client.config.client.includes('sqlite3')
? this.knex.raw('datetime(?)', [time])