feat: add support for tasks ELU in fair share strategy
[poolifier.git] / src / pools / selection-strategies / least-used-worker-choice-strategy.ts
index ee7834a6dc1bb12aeff39f25abf1f2b17f8dca49..4161a1d266634518c5800d57a421acb46b690fe6 100644 (file)
@@ -27,7 +27,7 @@ export class LeastUsedWorkerChoiceStrategy<
     opts: WorkerChoiceStrategyOptions = DEFAULT_WORKER_CHOICE_STRATEGY_OPTIONS
   ) {
     super(pool, opts)
-    this.setTaskStatistics(this.opts)
+    this.setTaskStatisticsRequirements(this.opts)
   }
 
   /** @inheritDoc */
@@ -51,7 +51,9 @@ export class LeastUsedWorkerChoiceStrategy<
     for (const [workerNodeKey, workerNode] of this.pool.workerNodes.entries()) {
       const workerTaskStatistics = workerNode.workerUsage.tasks
       const workerTasks =
-        workerTaskStatistics.executed + workerTaskStatistics.executing
+        workerTaskStatistics.executed +
+        workerTaskStatistics.executing +
+        workerTaskStatistics.queued
       if (workerTasks === 0) {
         return workerNodeKey
       } else if (workerTasks < minNumberOfTasks) {