Compare commits

..

4 Commits

Author SHA1 Message Date
725102d02c 3.0.24 2020-07-12 00:25:56 +00:00
7c73579c9f fix(core): update 2020-07-12 00:25:55 +00:00
a1996ea1bd 3.0.23 2020-07-12 00:00:50 +00:00
dc92ae7140 fix(core): update 2020-07-12 00:00:50 +00:00
4 changed files with 30 additions and 22 deletions

2
package-lock.json generated
View File

@ -1,6 +1,6 @@
{
"name": "@pushrocks/smarttime",
"version": "3.0.22",
"version": "3.0.24",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View File

@ -1,7 +1,7 @@
{
"name": "@pushrocks/smarttime",
"private": false,
"version": "3.0.22",
"version": "3.0.24",
"description": "handle time in smart ways",
"main": "dist_ts/index.js",
"typings": "dist_ts/index.d.ts",

View File

@ -1,4 +1,5 @@
export * from './smarttime.classes.cronmanager';
export * from './smarttime.classes.cronjob';
export * from './smarttime.classes.extendeddate';
export * from './smarttime.classes.hrtmeasurement';
export * from './smarttime.classes.interval';

View File

@ -28,6 +28,7 @@ export class CronManager {
* starts the cronjob
*/
public start() {
if (this.status !== 'started') {
this.status = 'started';
for (const cronJob of this.cronjobs.getArray()) {
cronJob.start();
@ -36,12 +37,17 @@ export class CronManager {
// recursion
const runCheckExecution = () => {
console.log(`Next CronJob scheduled in ${this.executionTimeout.getTimeLeft()} milliseconds`);
console.log(
`Next CronJob scheduled in ${this.executionTimeout.getTimeLeft()} milliseconds`
);
this.executionTimeout.promise.then(() => {
let timeToNextOverallExecution: number;
for (const cronJob of this.cronjobs.getArray()) {
const timeToNextJobExecution = cronJob.checkExecution();
if (timeToNextJobExecution < timeToNextOverallExecution || !timeToNextOverallExecution) {
if (
timeToNextJobExecution < timeToNextOverallExecution ||
!timeToNextOverallExecution
) {
timeToNextOverallExecution = timeToNextJobExecution;
}
}
@ -52,6 +58,7 @@ export class CronManager {
runCheckExecution();
}
}
/**
* stops all cronjobs