fix: fix race condition in worker choice strategies
[poolifier.git] / src / pools / selection-strategies / least-used-worker-choice-strategy.ts
index 4387d792ef951c2e602308b48d4caffd95e67d53..c750c290d1d7f3c5039698a9be04a2971b623781 100644 (file)
@@ -60,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
       }