From 10ee3c6a318ce844a03854f4cf48449a97a6dc6e Mon Sep 17 00:00:00 2001 From: TheEssem Date: Mon, 4 Jan 2021 17:33:13 -0600 Subject: [PATCH] Removed unnecessary message to main thread --- api/index.js | 9 --------- 1 file changed, 9 deletions(-) diff --git a/api/index.js b/api/index.js index 106f3ea..b86f292 100644 --- a/api/index.js +++ b/api/index.js @@ -56,14 +56,6 @@ if (isMainThread) { const worker = new Worker(__filename); log(`Spawned worker ${uuid}`); queue.shift(); - worker.once("message", (uuid) => { - // This means the worker is finished - workingWorkers--; - if (queue.length > 0) { - acceptJob(queue[0]); // Get the next job UUID in queue and remove it from the original queue - delete jobs[uuid]; - } - }); worker.once("error", err => { console.error(`Error on worker ${uuid}:`, err); socket.send(Buffer.concat([Buffer.from([0x2]), Buffer.from(uuid), Buffer.from(err.toString())]), jobs[uuid].port, jobs[uuid].addr); @@ -179,6 +171,5 @@ if (isMainThread) { socket.send(Buffer.concat([Buffer.from([0x1]), Buffer.from(job.uuid), Buffer.from(job.port.toString())]), job.port, job.addr, () => { socket.close(); }); - parentPort.postMessage(job.uuid); //Inform main thread about this worker freeing up }); } \ No newline at end of file