From 61bc5436a20484d6f11ca6a2df8221c42c2f7082 Mon Sep 17 00:00:00 2001 From: j433866 Date: Wed, 27 Mar 2019 09:26:01 +0000 Subject: [PATCH] Fix number of running workers not being correct. (This needs some work!) --- src/web/WorkerWaiter.mjs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/web/WorkerWaiter.mjs b/src/web/WorkerWaiter.mjs index 143539c4..4f8b7e06 100644 --- a/src/web/WorkerWaiter.mjs +++ b/src/web/WorkerWaiter.mjs @@ -71,11 +71,11 @@ class WorkerWaiter { data: r.data, inputNum: r.data.inputNum }); - log.error(this.pendingInputs); if (this.pendingInputs.length > 0) { log.debug("Bake complete. Baking next input"); this.bakeNextInput(r.data.inputNum); } else if (this.runningWorkers <= 0) { + this.runningWorkers = 0; this.recipeConfig = undefined; this.options = undefined; this.progress = undefined; @@ -84,6 +84,7 @@ class WorkerWaiter { } break; case "bakeError": + this.runningWorkers -= 1; this.app.handleError(r.data); this.setBakingStatus(false); break; @@ -213,6 +214,7 @@ class WorkerWaiter { const initialInputs = input.slice(0, this.chefWorkers.length); this.pendingInputs = input.slice(this.chefWorkers.length, input.length); + this.runningWorkers = 0; for (let i = 0; i < initialInputs.length; i++) { this.runningWorkers += 1;