fix: fix worker node removal handling in worker choice strategies
[poolifier.git] / src / pools / selection-strategies / interleaved-weighted-round-robin-worker-choice-strategy.ts
index 97a3aa04e5b941a31a053c53bf3f4416d15855f0..681870cbf1ad18b9fb10dfb539769c3abdd50777 100644 (file)
@@ -133,7 +133,10 @@ export class InterleavedWeightedRoundRobinWorkerChoiceStrategy<
   /** @inheritDoc */
   public remove (workerNodeKey: number): boolean {
     if (this.pool.workerNodes.length === 0) {
-      this.reset()
+      this.resetWorkerNodeKeyProperties()
+      this.workerNodeId = 0
+      this.workerNodeVirtualTaskRunTime = 0
+      return true
     }
     if (
       this.workerNodeId === workerNodeKey &&