Add and remove chefworkers when adding or removing inputs.

This increases the responsiveness of baking as it means we don't have to...
spin up workers when bake is clicked
This commit is contained in:
j433866 2019-05-28 14:11:05 +01:00
parent 7528065d4d
commit 6c711ec211
3 changed files with 30 additions and 8 deletions

View file

@ -106,7 +106,7 @@ class WorkerWaiter {
const newWorkerObj = {
worker: newWorker,
active: false,
inputNum: this.manager.input.getActiveTab()
inputNum: -1
};
this.chefWorkers.push(newWorkerObj);
@ -141,6 +141,7 @@ class WorkerWaiter {
}
if (this.chefWorkers.length > 1 || this.chefWorkers[index].active) {
log.debug(`Removing ChefWorker at index ${index}`);
this.chefWorkers[index].worker.terminate();
this.chefWorkers.splice(index, 1);
}
@ -230,7 +231,6 @@ class WorkerWaiter {
this.app.options[r.data.option] = r.data.value;
break;
case "setRegisters":
// Should this update with the tabs?
this.manager.recipe.setRegisters(r.data.opIndex, r.data.numPrevRegisters, r.data.registers);
break;
case "highlightsCalculated":