fix(core): update
This commit is contained in:
parent
20b181b2f3
commit
9b96779d19
8
ts/00_commitinfo_data.ts
Normal file
8
ts/00_commitinfo_data.ts
Normal 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'
|
||||||
|
}
|
@ -3,10 +3,10 @@ import { CronManager } from './smarttime.classes.cronmanager';
|
|||||||
|
|
||||||
import { CronParser } from './smarttime.classes.cronparser';
|
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 {
|
export class CronJob {
|
||||||
public cronParser: CronParser | typeof plugins.croner;
|
public cronParser: typeof plugins.croner;
|
||||||
public status: 'started' | 'stopped' | 'initial' = 'initial';
|
public status: 'started' | 'stopped' | 'initial' = 'initial';
|
||||||
public cronExpression: string;
|
public cronExpression: string;
|
||||||
public jobFunction: TJobFunction;
|
public jobFunction: TJobFunction;
|
||||||
@ -26,7 +26,7 @@ export class CronJob {
|
|||||||
this.getNextExecutionTime();
|
this.getNextExecutionTime();
|
||||||
}
|
}
|
||||||
if (Date.now() > this.nextExecutionUnix) {
|
if (Date.now() > this.nextExecutionUnix) {
|
||||||
const maybePromise = this.jobFunction();
|
const maybePromise = this.jobFunction(this.nextExecutionUnix);
|
||||||
if (maybePromise instanceof Promise) {
|
if (maybePromise instanceof Promise) {
|
||||||
maybePromise.catch(e => console.log(e));
|
maybePromise.catch(e => console.log(e));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user