Compare commits

..

8 Commits

Author SHA1 Message Date
f129ce42b6 3.0.26 2020-09-02 14:27:11 +00:00
56a802664f fix(core): update 2020-09-02 14:27:11 +00:00
743c9fb847 3.0.25 2020-09-02 14:09:22 +00:00
ac2edd6d74 fix(core): update 2020-09-02 14:09:21 +00:00
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
6 changed files with 840 additions and 1073 deletions

View File

@ -19,23 +19,35 @@ mirror:
stage: security stage: security
script: script:
- npmci git mirror - npmci git mirror
only:
- tags
tags: tags:
- lossless - lossless
- docker - docker
- notpriv - notpriv
audit: auditProductionDependencies:
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
stage: security
script:
- npmci npm prepare
- npmci command npm install --production --ignore-scripts
- npmci command npm config set registry https://registry.npmjs.org
- npmci command npm audit --audit-level=high --only=prod --production
tags:
- docker
auditDevDependencies:
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
stage: security stage: security
script: script:
- npmci npm prepare - npmci npm prepare
- npmci command npm install --ignore-scripts - npmci command npm install --ignore-scripts
- npmci command npm config set registry https://registry.npmjs.org - npmci command npm config set registry https://registry.npmjs.org
- npmci command npm audit --audit-level=high - npmci command npm audit --audit-level=high --only=dev
tags: tags:
- lossless
- docker - docker
- notpriv allow_failure: true
# ==================== # ====================
# test stage # test stage
@ -50,9 +62,7 @@ testStable:
- npmci npm test - npmci npm test
coverage: /\d+.?\d+?\%\s*coverage/ coverage: /\d+.?\d+?\%\s*coverage/
tags: tags:
- lossless
- docker - docker
- priv
testBuild: testBuild:
stage: test stage: test
@ -63,9 +73,7 @@ testBuild:
- npmci command npm run build - npmci command npm run build
coverage: /\d+.?\d+?\%\s*coverage/ coverage: /\d+.?\d+?\%\s*coverage/
tags: tags:
- lossless
- docker - docker
- notpriv
release: release:
stage: release stage: release
@ -85,6 +93,8 @@ release:
codequality: codequality:
stage: metadata stage: metadata
allow_failure: true allow_failure: true
only:
- tags
script: script:
- npmci command npm install -g tslint typescript - npmci command npm install -g tslint typescript
- npmci npm prepare - npmci npm prepare

View File

@ -15,7 +15,7 @@
"properties": { "properties": {
"projectType": { "projectType": {
"type": "string", "type": "string",
"enum": ["website", "element", "service", "npm"] "enum": ["website", "element", "service", "npm", "wcc"]
} }
} }
} }

1831
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
{ {
"name": "@pushrocks/smarttime", "name": "@pushrocks/smarttime",
"private": false, "private": false,
"version": "3.0.22", "version": "3.0.26",
"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",
@ -12,21 +12,21 @@
"build": "(tsbuild --web && tsbundle npm)" "build": "(tsbuild --web && tsbundle npm)"
}, },
"devDependencies": { "devDependencies": {
"@gitzone/tsbuild": "^2.1.11", "@gitzone/tsbuild": "^2.1.25",
"@gitzone/tsbundle": "^1.0.72", "@gitzone/tsbundle": "^1.0.78",
"@gitzone/tsrun": "^1.2.12", "@gitzone/tsrun": "^1.2.12",
"@gitzone/tstest": "^1.0.41", "@gitzone/tstest": "^1.0.44",
"@pushrocks/tapbundle": "^3.2.9", "@pushrocks/tapbundle": "^3.2.9",
"@types/node": "^14.0.22", "@types/node": "^14.6.2",
"tslint": "^6.1.2", "tslint": "^6.1.3",
"tslint-config-prettier": "^1.18.0" "tslint-config-prettier": "^1.18.0"
}, },
"dependencies": { "dependencies": {
"@pushrocks/lik": "^4.0.13", "@pushrocks/lik": "^4.0.17",
"@pushrocks/smartdelay": "^2.0.10", "@pushrocks/smartdelay": "^2.0.10",
"@pushrocks/smartpromise": "^3.0.2", "@pushrocks/smartpromise": "^3.0.2",
"croner": "^1.1.23", "croner": "^1.1.23",
"dayjs": "^1.8.29", "dayjs": "^1.8.35",
"is-nan": "^1.3.0" "is-nan": "^1.3.0"
}, },
"files": [ "files": [

View File

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

View File

@ -28,6 +28,7 @@ export class CronManager {
* starts the cronjob * starts the cronjob
*/ */
public start() { public start() {
if (this.status !== 'started') {
this.status = 'started'; this.status = 'started';
for (const cronJob of this.cronjobs.getArray()) { for (const cronJob of this.cronjobs.getArray()) {
cronJob.start(); cronJob.start();
@ -36,12 +37,17 @@ export class CronManager {
// recursion // recursion
const runCheckExecution = () => { 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(() => { this.executionTimeout.promise.then(() => {
let timeToNextOverallExecution: number; let timeToNextOverallExecution: number;
for (const cronJob of this.cronjobs.getArray()) { for (const cronJob of this.cronjobs.getArray()) {
const timeToNextJobExecution = cronJob.checkExecution(); const timeToNextJobExecution = cronJob.checkExecution();
if (timeToNextJobExecution < timeToNextOverallExecution || !timeToNextOverallExecution) { if (
timeToNextJobExecution < timeToNextOverallExecution ||
!timeToNextOverallExecution
) {
timeToNextOverallExecution = timeToNextJobExecution; timeToNextOverallExecution = timeToNextJobExecution;
} }
} }
@ -52,13 +58,18 @@ export class CronManager {
runCheckExecution(); runCheckExecution();
} }
}
/** /**
* stops all cronjobs * stops all cronjobs
*/ */
public stop() { public stop() {
if (this.status === 'started') {
this.status = 'stopped'; this.status = 'stopped';
this.executionTimeout.cancel(); this.executionTimeout.cancel();
} else {
console.log(`You tried to stop a CronManager that was not actually started.`);
}
for (const cron of this.cronjobs.getArray()) { for (const cron of this.cronjobs.getArray()) {
cron.stop(); cron.stop();
} }