Add protected removeWorker member function (#124)
[poolifier.git] / src / pools / abstract-pool.ts
index 6d7f5569f75f9027cae94136eccc9f1dcb023c6a..1ae188dd53cb2f194e586a0c82087db7f9ed1dc8 100644 (file)
@@ -102,6 +102,13 @@ export abstract class AbstractPool<
     }
   }
 
+  protected removeWorker (worker: Worker): void {
+    // Clean worker from data structure
+    const workerIndex = this.workers.indexOf(worker)
+    this.workers.splice(workerIndex, 1)
+    this.tasks.delete(worker)
+  }
+
   /**
    * Execute the task specified into the constructor with the data parameter.
    *