if (message.kill) {
this.sendToWorker(worker, { kill: 1 })
void this.destroyWorker(worker)
- // clean workers from data structures
- const workerIndex = this.workers.indexOf(worker)
- this.workers.splice(workerIndex, 1)
- this.tasks.delete(worker)
+ this.removeWorker(worker)
}
})
return worker