fix(cronmanager): improve cron scheduling and lifecycle handling; add wake/wakeCycle to promptly recalculate scheduling when jobs are added/removed/started/stopped, fix timeout handling, and update tests and deps

This commit is contained in:
2026-02-15 22:57:28 +00:00
parent 51943fad1c
commit 40d72de979
12 changed files with 4724 additions and 4810 deletions

View File

@@ -1,8 +1,6 @@
import * as plugins from './smarttime.plugins.js';
import { CronManager } from './smarttime.classes.cronmanager.js';
import { CronParser } from './smarttime.classes.cronparser.js';
export type TJobFunction =
| ((triggerTimeArg?: number) => void)
| ((triggerTimeArg?: number) => Promise<any>);
@@ -24,6 +22,9 @@ export class CronJob {
* checks wether the cronjob needs to be executed
*/
public checkExecution(): number {
if (this.status === 'stopped') {
return this.nextExecutionUnix;
}
if (this.nextExecutionUnix === 0) {
this.getNextExecutionTime();
}