fix(core): update

This commit is contained in:
Philipp Kunz 2020-09-07 17:35:50 +00:00
parent 495f63ec71
commit 16a77e4c41
3 changed files with 6 additions and 15 deletions

12
package-lock.json generated
View File

@ -1973,14 +1973,13 @@
} }
}, },
"@pushrocks/smarttime": { "@pushrocks/smarttime": {
"version": "3.0.31", "version": "3.0.34",
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmarttime/-/smarttime-3.0.31.tgz", "resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmarttime/-/smarttime-3.0.34.tgz",
"integrity": "sha512-44cbUrzgcVLJTnKPTqVvfnVQGN8LbS3sFpRiv2oII9Ba8evPP5clMeTdQTW3OYF8s2UxKuWV5tyNIlGaDlphEQ==", "integrity": "sha512-6d6sgEONRscO8SgxN3TPDyue5sSN46FXLvJIfRFzR07a5FG1Frqkc9lHISCGyS/sPEMZ7FfxRLCmUWq0Savg6g==",
"requires": { "requires": {
"@pushrocks/lik": "^4.0.17", "@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",
"dayjs": "^1.8.35", "dayjs": "^1.8.35",
"is-nan": "^1.3.0" "is-nan": "^1.3.0"
} }
@ -3837,11 +3836,6 @@
"sha.js": "^2.4.8" "sha.js": "^2.4.8"
} }
}, },
"croner": {
"version": "1.1.23",
"resolved": "https://verdaccio.lossless.one/croner/-/croner-1.1.23.tgz",
"integrity": "sha512-VsSyKBVtshU8qd2yPEWsBv5xxTLbRUuq6DX5bgUb4TTn/H6hmFGtfJtr0NKswu1UEsZZ6uhYc0kSOAvPlicQUA=="
},
"cross-spawn": { "cross-spawn": {
"version": "6.0.5", "version": "6.0.5",
"resolved": "https://verdaccio.lossless.one/cross-spawn/-/cross-spawn-6.0.5.tgz", "resolved": "https://verdaccio.lossless.one/cross-spawn/-/cross-spawn-6.0.5.tgz",

View File

@ -32,7 +32,7 @@
"@pushrocks/smartlog": "^2.0.36", "@pushrocks/smartlog": "^2.0.36",
"@pushrocks/smartpromise": "^3.0.6", "@pushrocks/smartpromise": "^3.0.6",
"@pushrocks/smartrx": "^2.0.18", "@pushrocks/smartrx": "^2.0.18",
"@pushrocks/smarttime": "^3.0.31", "@pushrocks/smarttime": "^3.0.34",
"@types/cron": "^1.7.2" "@types/cron": "^1.7.2"
}, },
"devDependencies": { "devDependencies": {

View File

@ -4,7 +4,6 @@ export class BufferRunner {
public task: Task; public task: Task;
// initialze by default // initialze by default
public bufferCounter: number = 0; public bufferCounter: number = 0;
public running: boolean = false;
constructor(taskArg: Task) { constructor(taskArg: Task) {
this.task = taskArg; this.task = taskArg;
} }
@ -16,7 +15,7 @@ export class BufferRunner {
const returnPromise: Promise<any> = this.task.cycleCounter.getPromiseForCycle( const returnPromise: Promise<any> = this.task.cycleCounter.getPromiseForCycle(
this.bufferCounter + 1 this.bufferCounter + 1
); );
if (!this.running) { if (!this.task.running) {
this._run(x); this._run(x);
} }
return returnPromise; return returnPromise;
@ -25,15 +24,13 @@ export class BufferRunner {
private _run(x) { private _run(x) {
const recursiveBufferRunner = (x) => { const recursiveBufferRunner = (x) => {
if (this.bufferCounter >= 0) { if (this.bufferCounter >= 0) {
this.running = true;
this.task.running = true; this.task.running = true;
Task.runTask(this.task, { x: x }).then((x) => { Task.runTask(this.task, { x: x }).then((x) => {
this.bufferCounter--; this.bufferCounter--; // this.bufferCounter drops below 0, the recursion stops.
this.task.cycleCounter.informOfCycle(x); this.task.cycleCounter.informOfCycle(x);
recursiveBufferRunner(x); recursiveBufferRunner(x);
}); });
} else { } else {
this.running = false;
this.task.running = false; this.task.running = false;
} }
}; };