X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fworker%2FWorkerSet.ts;fp=src%2Fworker%2FWorkerSet.ts;h=f22f195379616c32494623668030a7c8d32de2bd;hb=8ba9c85438f7a9a8a5f3b61dfad6d2a4e7215b50;hp=f10ca9c8ce0f4fbfbd58a10faf0f44ab6073b20a;hpb=d760a0a625ddec9919e7ad691ddcd60ded1452b0;p=e-mobility-charging-stations-simulator.git diff --git a/src/worker/WorkerSet.ts b/src/worker/WorkerSet.ts index f10ca9c8..f22f1953 100644 --- a/src/worker/WorkerSet.ts +++ b/src/worker/WorkerSet.ts @@ -92,6 +92,7 @@ export class WorkerSet extends WorkerAbstract { resolve() }) }) + worker.unref() await worker.terminate() await waitWorkerExit } @@ -147,6 +148,8 @@ export class WorkerSet extends WorkerAbstract { ) { 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)