@pushrocks/smarttime
Advanced tools
Comparing version 3.0.23 to 3.0.24
@@ -46,23 +46,26 @@ "use strict"; | ||
start() { | ||
this.status = 'started'; | ||
for (const cronJob of this.cronjobs.getArray()) { | ||
cronJob.start(); | ||
if (this.status !== 'started') { | ||
this.status = 'started'; | ||
for (const cronJob of this.cronjobs.getArray()) { | ||
cronJob.start(); | ||
} | ||
this.executionTimeout = new plugins.smartdelay.Timeout(0); | ||
// recursion | ||
const runCheckExecution = () => { | ||
console.log(`Next CronJob scheduled in ${this.executionTimeout.getTimeLeft()} milliseconds`); | ||
this.executionTimeout.promise.then(() => { | ||
let timeToNextOverallExecution; | ||
for (const cronJob of this.cronjobs.getArray()) { | ||
const timeToNextJobExecution = cronJob.checkExecution(); | ||
if (timeToNextJobExecution < timeToNextOverallExecution || | ||
!timeToNextOverallExecution) { | ||
timeToNextOverallExecution = timeToNextJobExecution; | ||
} | ||
} | ||
this.executionTimeout = new plugins.smartdelay.Timeout(timeToNextOverallExecution); | ||
runCheckExecution(); | ||
}); | ||
}; | ||
runCheckExecution(); | ||
} | ||
this.executionTimeout = new plugins.smartdelay.Timeout(0); | ||
// recursion | ||
const runCheckExecution = () => { | ||
console.log(`Next CronJob scheduled in ${this.executionTimeout.getTimeLeft()} milliseconds`); | ||
this.executionTimeout.promise.then(() => { | ||
let timeToNextOverallExecution; | ||
for (const cronJob of this.cronjobs.getArray()) { | ||
const timeToNextJobExecution = cronJob.checkExecution(); | ||
if (timeToNextJobExecution < timeToNextOverallExecution || !timeToNextOverallExecution) { | ||
timeToNextOverallExecution = timeToNextJobExecution; | ||
} | ||
} | ||
this.executionTimeout = new plugins.smartdelay.Timeout(timeToNextOverallExecution); | ||
runCheckExecution(); | ||
}); | ||
}; | ||
runCheckExecution(); | ||
} | ||
@@ -81,2 +84,2 @@ /** | ||
exports.CronManager = CronManager; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnR0aW1lLmNsYXNzZXM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FDLFVBQVUsQ0FBQyxPQUFPLENBQUMsMEJBQTBCLENBQUMsQ0FBQztvQkFDbkYsaUJBQWlCLEVBQUUsQ0FBQztnQkFDdEIsQ0FBQyxDQUFDLENBQUM7WUFDTCxDQUFDLENBQUM7WUFFRixpQkFBaUIsRUFBRSxDQUFDO1NBQ3JCO0lBQ0gsQ0FBQztJQUVEOztPQUVHO0lBQ0ksSUFBSTtRQUNULElBQUksQ0FBQyxNQUFNLEdBQUcsU0FBUyxDQUFDO1FBQ3hCLElBQUksQ0FBQyxnQkFBZ0IsQ0FBQyxNQUFNLEVBQUUsQ0FBQztRQUMvQixLQUFLLE1BQU0sSUFBSSxJQUFJLElBQUksQ0FBQyxRQUFRLENBQUMsUUFBUSxFQUFFLEVBQUU7WUFDM0MsSUFBSSxDQUFDLElBQUksRUFBRSxDQUFDO1NBQ2I7SUFDSCxDQUFDO0NBQ0Y7QUFyRUQsa0NBcUVDIn0= |
{ | ||
"name": "@pushrocks/smarttime", | ||
"private": false, | ||
"version": "3.0.23", | ||
"version": "3.0.24", | ||
"description": "handle time in smart ways", | ||
@@ -6,0 +6,0 @@ "main": "dist_ts/index.js", |
@@ -31,25 +31,32 @@ import * as plugins from './smarttime.plugins'; | ||
public start() { | ||
this.status = 'started'; | ||
for (const cronJob of this.cronjobs.getArray()) { | ||
cronJob.start(); | ||
} | ||
this.executionTimeout = new plugins.smartdelay.Timeout(0); | ||
if (this.status !== 'started') { | ||
this.status = 'started'; | ||
for (const cronJob of this.cronjobs.getArray()) { | ||
cronJob.start(); | ||
} | ||
this.executionTimeout = new plugins.smartdelay.Timeout(0); | ||
// recursion | ||
const runCheckExecution = () => { | ||
console.log(`Next CronJob scheduled in ${this.executionTimeout.getTimeLeft()} milliseconds`); | ||
this.executionTimeout.promise.then(() => { | ||
let timeToNextOverallExecution: number; | ||
for (const cronJob of this.cronjobs.getArray()) { | ||
const timeToNextJobExecution = cronJob.checkExecution(); | ||
if (timeToNextJobExecution < timeToNextOverallExecution || !timeToNextOverallExecution) { | ||
timeToNextOverallExecution = timeToNextJobExecution; | ||
// recursion | ||
const runCheckExecution = () => { | ||
console.log( | ||
`Next CronJob scheduled in ${this.executionTimeout.getTimeLeft()} milliseconds` | ||
); | ||
this.executionTimeout.promise.then(() => { | ||
let timeToNextOverallExecution: number; | ||
for (const cronJob of this.cronjobs.getArray()) { | ||
const timeToNextJobExecution = cronJob.checkExecution(); | ||
if ( | ||
timeToNextJobExecution < timeToNextOverallExecution || | ||
!timeToNextOverallExecution | ||
) { | ||
timeToNextOverallExecution = timeToNextJobExecution; | ||
} | ||
} | ||
} | ||
this.executionTimeout = new plugins.smartdelay.Timeout(timeToNextOverallExecution); | ||
runCheckExecution(); | ||
}); | ||
}; | ||
this.executionTimeout = new plugins.smartdelay.Timeout(timeToNextOverallExecution); | ||
runCheckExecution(); | ||
}); | ||
}; | ||
runCheckExecution(); | ||
runCheckExecution(); | ||
} | ||
} | ||
@@ -56,0 +63,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1477252
12977