return super.chooseWorker()
}
// All workers are busy, create a new worker
- const worker = this.internalNewWorker()
+ const worker = this.createAndSetupWorker()
worker.on('message', (message: MessageValue<Data>) => {
if (message.kill) {
this.sendToWorker(worker, { kill: 1 })
void this.destroyWorker(worker)
- this.removeWorker(worker)
}
})
return worker