fix(core): update
This commit is contained in:
parent
a1996ea1bd
commit
7c73579c9f
@ -28,6 +28,7 @@ export class CronManager {
|
||||
* starts the cronjob
|
||||
*/
|
||||
public start() {
|
||||
if (this.status !== 'started') {
|
||||
this.status = 'started';
|
||||
for (const cronJob of this.cronjobs.getArray()) {
|
||||
cronJob.start();
|
||||
@ -36,12 +37,17 @@ export class CronManager {
|
||||
|
||||
// recursion
|
||||
const runCheckExecution = () => {
|
||||
console.log(`Next CronJob scheduled in ${this.executionTimeout.getTimeLeft()} milliseconds`);
|
||||
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) {
|
||||
if (
|
||||
timeToNextJobExecution < timeToNextOverallExecution ||
|
||||
!timeToNextOverallExecution
|
||||
) {
|
||||
timeToNextOverallExecution = timeToNextJobExecution;
|
||||
}
|
||||
}
|
||||
@ -52,6 +58,7 @@ export class CronManager {
|
||||
|
||||
runCheckExecution();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* stops all cronjobs
|
||||
|
Loading…
x
Reference in New Issue
Block a user