test: cleanup helpers
[poolifier.git] / src / pools / cluster / fixed.ts
index a13a95ceea7aed2a01c98a4f8641408ad2c38741..3f56c858b0ed5b363fc19da06eb1b9a295a66dd5 100644 (file)
@@ -69,7 +69,10 @@ export class FixedClusterPool<
   /** @inheritDoc */
   protected destroyWorker (worker: Worker): void {
     this.sendToWorker(worker, { kill: 1 })
-    worker.kill()
+    worker.on('disconnect', () => {
+      worker.kill()
+    })
+    worker.disconnect()
   }
 
   /** @inheritDoc */