2
0
mirror of https://github.com/gchq/CyberChef synced 2025-12-11 05:43:28 +00:00

Don't create more ChefWorkers than we need.

This commit is contained in:
j433866
2019-05-08 10:53:04 +01:00
parent 28182713bf
commit 689d08416b

View File

@@ -148,6 +148,7 @@ class WorkerWaiter {
case "bakeError":
if (!r.data.hasOwnProperty("progress")) this.app.handleError(r.data.error);
this.manager.output.updateOutputError(r.data.error, inputNum, r.data.progress);
this.app.progress = r.data.progress;
this.workerFinished(currentWorker);
// do more here
break;
@@ -378,7 +379,11 @@ class WorkerWaiter {
this.progress = progress;
this.step = step;
for (let i = 0; i < this.maxWorkers; i++) {
let numWorkers = this.maxWorkers;
if (this.inputs.length < numWorkers) {
numWorkers = this.inputs.length;
}
for (let i = 0; i < numWorkers; i++) {
const workerIdx = this.addChefWorker();
if (workerIdx === -1) break;
this.bakeNextInput(workerIdx);