fix(core): update

This commit is contained in:
Philipp Kunz 2022-11-21 01:19:38 +01:00
parent 20b181b2f3
commit 9b96779d19
2 changed files with 11 additions and 3 deletions

8
ts/00_commitinfo_data.ts Normal file
View File

@ -0,0 +1,8 @@
/**
* autocreated commitinfo by @pushrocks/commitinfo
*/
export const commitinfo = {
name: '@pushrocks/smarttime',
version: '3.0.46',
description: 'handle time in smart ways'
}

View File

@ -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));
}