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:
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user