refactor: refine autocannon parameters
[poolifier.git] / src / pools / selection-strategies / least-used-worker-choice-strategy.ts
index 515b4e935db6e33fd5f3946c4f1b7cb0eb52a5f0..c750c290d1d7f3c5039698a9be04a2971b623781 100644 (file)
@@ -42,8 +42,7 @@ export class LeastUsedWorkerChoiceStrategy<
 
   /** @inheritDoc */
   public choose (): number | undefined {
-    const chosenWorkerNodeKey = this.leastUsedNextWorkerNodeKey()
-    this.assignChosenWorkerNodeKey(chosenWorkerNodeKey)
+    this.nextWorkerNodeKey = this.leastUsedNextWorkerNodeKey()
     return this.nextWorkerNodeKey
   }
 
@@ -61,13 +60,10 @@ export class LeastUsedWorkerChoiceStrategy<
         workerTaskStatistics.executed +
         workerTaskStatistics.executing +
         workerTaskStatistics.queued
-      if (this.isWorkerNodeEligible(workerNodeKey) && workerTasks === 0) {
+      if (workerTasks === 0) {
         chosenWorkerNodeKey = workerNodeKey
         break
-      } else if (
-        this.isWorkerNodeEligible(workerNodeKey) &&
-        workerTasks < minNumberOfTasks
-      ) {
+      } else if (workerTasks < minNumberOfTasks) {
         minNumberOfTasks = workerTasks
         chosenWorkerNodeKey = workerNodeKey
       }