fix(core): update
This commit is contained in:
parent
edadbe6cf5
commit
4dd4980374
@ -119,6 +119,6 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
npmci node install stable
|
npmci node install stable
|
||||||
npmci npm install
|
npmci npm install
|
||||||
pnpm install -g @gitzone/tsdoc
|
pnpm install -g @git.zone/tsdoc
|
||||||
npmci command tsdoc
|
npmci command tsdoc
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
|
18
package.json
18
package.json
@ -13,19 +13,19 @@
|
|||||||
"buildDocs": "tsdoc"
|
"buildDocs": "tsdoc"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@gitzone/tsbuild": "^2.1.66",
|
"@git.zone/tsbuild": "^2.1.66",
|
||||||
"@gitzone/tsbundle": "^2.0.8",
|
"@git.zone/tsbundle": "^2.0.8",
|
||||||
"@gitzone/tsrun": "^1.2.44",
|
"@git.zone/tsrun": "^1.2.44",
|
||||||
"@gitzone/tstest": "^1.0.77",
|
"@git.zone/tstest": "^1.0.77",
|
||||||
"@push.rocks/tapbundle": "^5.0.12",
|
"@push.rocks/tapbundle": "^5.0.15",
|
||||||
"@types/node": "^20.4.2"
|
"@types/node": "^20.8.7"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@push.rocks/lik": "^6.0.3",
|
"@push.rocks/lik": "^6.0.5",
|
||||||
"@push.rocks/smartdelay": "^3.0.5",
|
"@push.rocks/smartdelay": "^3.0.5",
|
||||||
"@push.rocks/smartpromise": "^4.0.3",
|
"@push.rocks/smartpromise": "^4.0.3",
|
||||||
"croner": "^5.3.4",
|
"croner": "^7.0.3",
|
||||||
"dayjs": "^1.11.9",
|
"dayjs": "^1.11.10",
|
||||||
"is-nan": "^1.3.2",
|
"is-nan": "^1.3.2",
|
||||||
"pretty-ms": "^8.0.0"
|
"pretty-ms": "^8.0.0"
|
||||||
},
|
},
|
||||||
|
2511
pnpm-lock.yaml
generated
2511
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@ -3,6 +3,6 @@
|
|||||||
*/
|
*/
|
||||||
export const commitinfo = {
|
export const commitinfo = {
|
||||||
name: '@push.rocks/smarttime',
|
name: '@push.rocks/smarttime',
|
||||||
version: '4.0.5',
|
version: '4.0.6',
|
||||||
description: 'handle time in smart ways'
|
description: 'handle time in smart ways'
|
||||||
}
|
}
|
||||||
|
@ -34,40 +34,41 @@ export class CronManager {
|
|||||||
for (const cronJob of this.cronjobs.getArray()) {
|
for (const cronJob of this.cronjobs.getArray()) {
|
||||||
cronJob.start();
|
cronJob.start();
|
||||||
}
|
}
|
||||||
const runCronCycle = async () => {
|
this.runCronCycle();
|
||||||
this.executionTimeout = new plugins.smartdelay.Timeout(0);
|
|
||||||
do {
|
|
||||||
let nextRunningCronjob: CronJob;
|
|
||||||
for (const cronJob of this.cronjobs.getArray()) {
|
|
||||||
cronJob.checkExecution();
|
|
||||||
if (
|
|
||||||
!nextRunningCronjob ||
|
|
||||||
cronJob.getTimeToNextExecution() < nextRunningCronjob.getTimeToNextExecution()
|
|
||||||
) {
|
|
||||||
nextRunningCronjob = cronJob;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (nextRunningCronjob) {
|
|
||||||
this.executionTimeout = new plugins.smartdelay.Timeout(
|
|
||||||
nextRunningCronjob.getTimeToNextExecution()
|
|
||||||
);
|
|
||||||
console.log(
|
|
||||||
`Next CronJob scheduled in ${getMilliSecondsAsHumanReadableString(
|
|
||||||
this.executionTimeout.getTimeLeft()
|
|
||||||
)}`
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
this.executionTimeout = new plugins.smartdelay.Timeout(1000);
|
|
||||||
console.log('no cronjobs specified! Checking again in 1 second');
|
|
||||||
}
|
|
||||||
|
|
||||||
await this.executionTimeout.promise;
|
|
||||||
} while (this.status === 'started');
|
|
||||||
};
|
|
||||||
runCronCycle();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async runCronCycle() {
|
||||||
|
this.executionTimeout = new plugins.smartdelay.Timeout(0);
|
||||||
|
do {
|
||||||
|
let nextRunningCronjob: CronJob;
|
||||||
|
for (const cronJob of this.cronjobs.getArray()) {
|
||||||
|
cronJob.checkExecution();
|
||||||
|
if (
|
||||||
|
!nextRunningCronjob ||
|
||||||
|
cronJob.getTimeToNextExecution() < nextRunningCronjob.getTimeToNextExecution()
|
||||||
|
) {
|
||||||
|
nextRunningCronjob = cronJob;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (nextRunningCronjob) {
|
||||||
|
this.executionTimeout = new plugins.smartdelay.Timeout(
|
||||||
|
nextRunningCronjob.getTimeToNextExecution()
|
||||||
|
);
|
||||||
|
console.log(
|
||||||
|
`Next CronJob scheduled in ${getMilliSecondsAsHumanReadableString(
|
||||||
|
this.executionTimeout.getTimeLeft()
|
||||||
|
)}`
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
this.executionTimeout = new plugins.smartdelay.Timeout(1000);
|
||||||
|
console.log('no cronjobs specified! Checking again in 1 second');
|
||||||
|
}
|
||||||
|
|
||||||
|
await this.executionTimeout.promise;
|
||||||
|
} while (this.status === 'started');
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* stops all cronjobs
|
* stops all cronjobs
|
||||||
*/
|
*/
|
||||||
|
@ -36,7 +36,7 @@ export class Timer {
|
|||||||
/**
|
/**
|
||||||
* the current timeout the needs to be canceled when this Timer is stopped
|
* the current timeout the needs to be canceled when this Timer is stopped
|
||||||
*/
|
*/
|
||||||
private currentTimeout: NodeJS.Timer;
|
private currentTimeout: NodeJS.Timeout;
|
||||||
|
|
||||||
// a deferred triggeted when Timer has completed
|
// a deferred triggeted when Timer has completed
|
||||||
private completedDeferred = plugins.smartpromise.defer<void>();
|
private completedDeferred = plugins.smartpromise.defer<void>();
|
||||||
|
@ -3,9 +3,12 @@
|
|||||||
"experimentalDecorators": true,
|
"experimentalDecorators": true,
|
||||||
"useDefineForClassFields": false,
|
"useDefineForClassFields": false,
|
||||||
"target": "ES2022",
|
"target": "ES2022",
|
||||||
"module": "ES2022",
|
"module": "NodeNext",
|
||||||
"moduleResolution": "nodenext",
|
"moduleResolution": "NodeNext",
|
||||||
"esModuleInterop": true,
|
"esModuleInterop": true,
|
||||||
"verbatimModuleSyntax": true,
|
"verbatimModuleSyntax": true
|
||||||
}
|
},
|
||||||
|
"exclude": [
|
||||||
|
"dist_*/**/*.d.ts"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user