cleanup
This commit is contained in:
parent
f2b180fedb
commit
59a9ec907f
1 changed files with 7 additions and 10 deletions
|
@ -20,20 +20,22 @@ module.exports = class {
|
|||
|
||||
this.toRemove = [];
|
||||
|
||||
// WoAh!!! Thread pool in js!?!??!???!11!?!?!
|
||||
for (let i = 0; i < config.threadPoolCount; i++) {
|
||||
const worker = new Worker(workerPath);
|
||||
this.threadPool.push([false, worker]);
|
||||
const myID = i;
|
||||
worker.on("message", (data) => {
|
||||
/*const user = global.getUserByKey(message[0]);
|
||||
for (let square of message[1]) { user.chunksToSend.add(Buffer.from(square)); }
|
||||
this.threadPool[myID][0] = false;
|
||||
this.toRemove.push(message[2]);*/
|
||||
switch (data[0]) {
|
||||
case "chunk":
|
||||
const user = global.getUserByKey(data[2]);
|
||||
user.chunksToSend.add(Buffer.from(data[1]));
|
||||
//this.threadPool[myID][0] = false;
|
||||
break;
|
||||
|
||||
// Specific to the chunk task as multiple of them are sent before removal
|
||||
case "remove":
|
||||
this.toRemove.push(data[1]);
|
||||
this.threadPool[myID][0] = false;
|
||||
break;
|
||||
|
||||
case "generate":
|
||||
|
@ -41,11 +43,6 @@ module.exports = class {
|
|||
this.toRemove.push(data[4]);
|
||||
this.threadPool[myID][0] = false;
|
||||
break;
|
||||
|
||||
case "remove":
|
||||
this.toRemove.push(data[1]);
|
||||
this.threadPool[myID][0] = false;
|
||||
break;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue