Fix number of running workers not being correct.

(This needs some work!)
This commit is contained in:
j433866 2019-03-27 09:26:01 +00:00
parent 37428fbe3b
commit 61bc5436a2
1 changed files with 3 additions and 1 deletions

View File

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