Refine attributes scope in dynamic pool code
[poolifier.git] / src / pools / selection-strategies / weighted-round-robin-worker-choice-strategy.ts
index aa751e5437b640ca999ab17c684fc9f32a95882d..4b1e5382af333d2edb59eb5ae41d1c5132f6ccb3 100644 (file)
@@ -91,7 +91,11 @@ export class WeightedRoundRobinWorkerChoiceStrategy<
         this.currentWorkerIndex === this.pool.workers.length - 1
           ? 0
           : this.currentWorkerIndex + 1
-      this.setWorkerTaskRunTime(chosenWorker, workerTaskWeight, 0)
+      this.setWorkerTaskRunTime(
+        this.pool.workers[this.currentWorkerIndex],
+        workerTaskWeight,
+        0
+      )
     }
     return chosenWorker
   }