Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
dd783b455f | |||
996685e7fb | |||
110b2c00cf | |||
c8b455b8e2 | |||
d16fd8b69b | |||
f7ed88cd57 |
2
package-lock.json
generated
2
package-lock.json
generated
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@pushrocks/smarttime",
|
"name": "@pushrocks/smarttime",
|
||||||
"version": "3.0.29",
|
"version": "3.0.32",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
{
|
{
|
||||||
"name": "@pushrocks/smarttime",
|
"name": "@pushrocks/smarttime",
|
||||||
"private": false,
|
"private": false,
|
||||||
"version": "3.0.29",
|
"version": "3.0.32",
|
||||||
"description": "handle time in smart ways",
|
"description": "handle time in smart ways",
|
||||||
"main": "dist_ts/index.js",
|
"main": "dist_ts/index.js",
|
||||||
"typings": "dist_ts/index.d.ts",
|
"typings": "dist_ts/index.d.ts",
|
||||||
"author": "Lossless GmbH",
|
"author": "Lossless GmbH",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "(tstest ./test/)",
|
"test": "(tstest ./test)",
|
||||||
"build": "(tsbuild --web && tsbundle npm)"
|
"build": "(tsbuild --web && tsbundle npm)"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
@ -13,7 +13,7 @@ export class CronJob {
|
|||||||
constructor(cronManager: CronManager, cronExpressionArg: string, jobFunction: TJobFunction) {
|
constructor(cronManager: CronManager, cronExpressionArg: string, jobFunction: TJobFunction) {
|
||||||
this.cronExpression = cronExpressionArg;
|
this.cronExpression = cronExpressionArg;
|
||||||
this.jobFunction = jobFunction;
|
this.jobFunction = jobFunction;
|
||||||
this.croner = plugins.croner(this.cronExpression);
|
// this.croner = plugins.croner(this.cronExpression);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -41,7 +41,7 @@ export class CronJob {
|
|||||||
* gets the time to next execution
|
* gets the time to next execution
|
||||||
*/
|
*/
|
||||||
public getTimeToNextExecution() {
|
public getTimeToNextExecution() {
|
||||||
return this.croner.msToNext();
|
return 600000;
|
||||||
}
|
}
|
||||||
|
|
||||||
public start() {
|
public start() {
|
||||||
|
@ -46,10 +46,17 @@ export class CronManager {
|
|||||||
nextRunningCronjob = cronJob;
|
nextRunningCronjob = cronJob;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.executionTimeout = new plugins.smartdelay.Timeout(nextRunningCronjob.getTimeToNextExecution());
|
if (nextRunningCronjob) {
|
||||||
console.log(
|
this.executionTimeout = new plugins.smartdelay.Timeout(nextRunningCronjob.getTimeToNextExecution());
|
||||||
`Next CronJob scheduled in ${this.executionTimeout.getTimeLeft()} milliseconds`
|
console.log(
|
||||||
);
|
`Next CronJob scheduled in ${this.executionTimeout.getTimeLeft()} milliseconds`
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
this.executionTimeout = new plugins.smartdelay.Timeout(1000);
|
||||||
|
console.log('no cronjobs specified! Checking again in 1 second');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
await this.executionTimeout.promise;
|
await this.executionTimeout.promise;
|
||||||
} while (this.status === 'started');
|
} while (this.status === 'started');
|
||||||
};
|
};
|
||||||
|
@ -6,7 +6,6 @@ import * as smartpromise from '@pushrocks/smartpromise';
|
|||||||
export { lik, smartdelay, smartpromise };
|
export { lik, smartdelay, smartpromise };
|
||||||
|
|
||||||
// third parties
|
// third parties
|
||||||
import croner from 'croner';
|
|
||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
|
|
||||||
export { croner, dayjs };
|
export { dayjs };
|
||||||
|
Reference in New Issue
Block a user