Compare commits

..

8 Commits

Author SHA1 Message Date
7da0035805 2.1.12 2020-09-07 17:35:51 +00:00
16a77e4c41 fix(core): update 2020-09-07 17:35:50 +00:00
495f63ec71 2.1.11 2020-09-04 16:09:44 +00:00
17f840d24c fix(core): update 2020-09-04 16:09:44 +00:00
b93407e83a 2.1.10 2020-09-04 06:47:31 +00:00
003c1f2796 fix(core): update 2020-09-04 06:47:30 +00:00
7f72a88846 2.1.9 2020-09-03 20:43:38 +00:00
823d4f7d55 fix(core): update 2020-09-03 20:43:37 +00:00
3 changed files with 12 additions and 21 deletions

20
package-lock.json generated
View File

@ -1,6 +1,6 @@
{
"name": "@pushrocks/taskbuffer",
"version": "2.1.8",
"version": "2.1.12",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
@ -1973,14 +1973,13 @@
}
},
"@pushrocks/smarttime": {
"version": "3.0.26",
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmarttime/-/smarttime-3.0.26.tgz",
"integrity": "sha512-JzRAYR7xPvNPPFj2euU8jmnAc+1wwDCB/Or7aZ7eADP9XXV9xCXpYXw6KcCYC/UQ8HqXLunbS+371eZcU2dJaA==",
"version": "3.0.34",
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmarttime/-/smarttime-3.0.34.tgz",
"integrity": "sha512-6d6sgEONRscO8SgxN3TPDyue5sSN46FXLvJIfRFzR07a5FG1Frqkc9lHISCGyS/sPEMZ7FfxRLCmUWq0Savg6g==",
"requires": {
"@pushrocks/lik": "^4.0.17",
"@pushrocks/smartdelay": "^2.0.10",
"@pushrocks/smartpromise": "^3.0.2",
"croner": "^1.1.23",
"dayjs": "^1.8.35",
"is-nan": "^1.3.0"
}
@ -2297,9 +2296,9 @@
"integrity": "sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA=="
},
"@types/node": {
"version": "14.6.2",
"resolved": "https://verdaccio.lossless.one/@types%2fnode/-/node-14.6.2.tgz",
"integrity": "sha512-onlIwbaeqvZyniGPfdw/TEhKIh79pz66L1q06WUQqJLnAb6wbjvOtepLYTGHTqzdXgBYIE3ZdmqHDGsRsbBz7A=="
"version": "14.6.4",
"resolved": "https://verdaccio.lossless.one/@types%2fnode/-/node-14.6.4.tgz",
"integrity": "sha512-Wk7nG1JSaMfMpoMJDKUsWYugliB2Vy55pdjLpmLixeyMi7HizW2I/9QoxsPCkXl3dO+ZOVqPumKaDUv5zJu2uQ=="
},
"@types/parcel-bundler": {
"version": "1.12.1",
@ -3837,11 +3836,6 @@
"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": {
"version": "6.0.5",
"resolved": "https://verdaccio.lossless.one/cross-spawn/-/cross-spawn-6.0.5.tgz",

View File

@ -1,6 +1,6 @@
{
"name": "@pushrocks/taskbuffer",
"version": "2.1.8",
"version": "2.1.12",
"private": false,
"description": "flexible task management. TypeScript ready!",
"main": "dist_ts/index.js",
@ -32,7 +32,7 @@
"@pushrocks/smartlog": "^2.0.36",
"@pushrocks/smartpromise": "^3.0.6",
"@pushrocks/smartrx": "^2.0.18",
"@pushrocks/smarttime": "^3.0.26",
"@pushrocks/smarttime": "^3.0.34",
"@types/cron": "^1.7.2"
},
"devDependencies": {
@ -40,7 +40,7 @@
"@gitzone/tsbundle": "^1.0.78",
"@gitzone/tstest": "^1.0.44",
"@pushrocks/tapbundle": "^3.2.9",
"@types/node": "^14.6.2",
"@types/node": "^14.6.4",
"tslint": "^6.1.3",
"tslint-config-prettier": "^1.18.0"
},

View File

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