Compare commits

..

6 Commits

Author SHA1 Message Date
8f9b3151d8 2.1.13 2020-09-07 23:52:23 +00:00
81e97b513a fix(core): update 2020-09-07 23:52:22 +00:00
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
3 changed files with 12 additions and 15 deletions

14
package-lock.json generated
View File

@ -1,6 +1,6 @@
{
"name": "@pushrocks/taskbuffer",
"version": "2.1.10",
"version": "2.1.13",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
@ -1589,9 +1589,9 @@
}
},
"@pushrocks/smartlog": {
"version": "2.0.36",
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartlog/-/smartlog-2.0.36.tgz",
"integrity": "sha512-guM03567UFZebx3urBQdiQecZwKvrR8c8fzt7EDPrI1ihArZc7ab6MQEu9yklPKqJMGLEz8t0oExgQ8804r73g==",
"version": "2.0.37",
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartlog/-/smartlog-2.0.37.tgz",
"integrity": "sha512-EfF/Zp8tpRdJwZtwFMeQdurd4wEvT2S/kx9iRf362aER93wyO8NUuGyyN6U52hgEN5r1VDgG27lpNXc+ZKwRMw==",
"requires": {
"@pushrocks/isounique": "^1.0.4",
"@pushrocks/smartlog-interfaces": "^2.0.20"
@ -1973,9 +1973,9 @@
}
},
"@pushrocks/smarttime": {
"version": "3.0.29",
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmarttime/-/smarttime-3.0.29.tgz",
"integrity": "sha512-ZtF86APSWipUxFteWlfe7rxwoxUC/vQ8+dgjruOmErW2YTQLns3nSnIMC0LMt6ks2+fjT9UTb1jAJhOCDI5twQ==",
"version": "3.0.35",
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmarttime/-/smarttime-3.0.35.tgz",
"integrity": "sha512-KBDprr2gMcw+21kD6GkJ0Y9fc/SuMijhFPDKoBmuCW9Nhn+KAnabCB8Qn8OzeUuQcoHQ3SFJ/4KioJWNxMgxaQ==",
"requires": {
"@pushrocks/lik": "^4.0.17",
"@pushrocks/smartdelay": "^2.0.10",

View File

@ -1,6 +1,6 @@
{
"name": "@pushrocks/taskbuffer",
"version": "2.1.10",
"version": "2.1.13",
"private": false,
"description": "flexible task management. TypeScript ready!",
"main": "dist_ts/index.js",
@ -29,10 +29,10 @@
"dependencies": {
"@pushrocks/lik": "^4.0.17",
"@pushrocks/smartdelay": "^2.0.10",
"@pushrocks/smartlog": "^2.0.36",
"@pushrocks/smartlog": "^2.0.37",
"@pushrocks/smartpromise": "^3.0.6",
"@pushrocks/smartrx": "^2.0.18",
"@pushrocks/smarttime": "^3.0.29",
"@pushrocks/smarttime": "^3.0.35",
"@types/cron": "^1.7.2"
},
"devDependencies": {

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;
}
};