version: workerSetVersion,
type: 'set',
worker: 'thread',
+ started: this.started,
size: this.size,
elementsExecuting: [...this.workerSet].reduce(
(accumulator, workerSetElement) => accumulator + workerSetElement.numberOfWorkerElements,
resolve()
})
})
+ worker.unref()
await worker.terminate()
await waitWorkerExit
- this.emitter?.emit(WorkerSetEvents.stopped, this.info)
- this.emitter?.emitDestroy()
- this.emitter?.removeAllListeners()
- this.started = false
}
+ this.emitter?.emit(WorkerSetEvents.stopped, this.info)
+ this.started = false
+ this.emitter?.emitDestroy()
+ this.emitter?.removeAllListeners()
}
/** @inheritDoc */
) {
this.addWorkerSetElement()
}
+ worker.unref()
+ worker.terminate().catch(error => this.emitter?.emit(WorkerSetEvents.error, error))
})
worker.on('online', this.workerOptions.poolOptions?.onlineHandler ?? EMPTY_FUNCTION)
worker.on('exit', this.workerOptions.poolOptions?.exitHandler ?? EMPTY_FUNCTION)