fix: ensure `worker_threads` workers are unreferenced at termination
[poolifier.git] / src / pools / worker-node.ts
index 308215176edb515851c2349ba550d3cc50e2611b..523036a5eac6f57db2966131652b29da6423fea1 100644 (file)
@@ -137,6 +137,7 @@ export class WorkerNode<Worker extends IWorker, Data = unknown>
     this.removeAllListeners()
     switch (this.info.type) {
       case WorkerTypes.thread:
+        this.worker.unref?.()
         await this.worker.terminate?.()
         break
       case WorkerTypes.cluster: