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