fix(core): update
This commit is contained in:
@@ -3,10 +3,10 @@ import { CronManager } from './smarttime.classes.cronmanager';
|
||||
|
||||
import { CronParser } from './smarttime.classes.cronparser';
|
||||
|
||||
export type TJobFunction = (() => void) | (() => Promise<any>);
|
||||
export type TJobFunction = ((triggerTimeArg?: number) => void) | ((triggerTimeArg?: number) => Promise<any>);
|
||||
|
||||
export class CronJob {
|
||||
public cronParser: CronParser | typeof plugins.croner;
|
||||
public cronParser: typeof plugins.croner;
|
||||
public status: 'started' | 'stopped' | 'initial' = 'initial';
|
||||
public cronExpression: string;
|
||||
public jobFunction: TJobFunction;
|
||||
@@ -26,7 +26,7 @@ export class CronJob {
|
||||
this.getNextExecutionTime();
|
||||
}
|
||||
if (Date.now() > this.nextExecutionUnix) {
|
||||
const maybePromise = this.jobFunction();
|
||||
const maybePromise = this.jobFunction(this.nextExecutionUnix);
|
||||
if (maybePromise instanceof Promise) {
|
||||
maybePromise.catch(e => console.log(e));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user