docs: add type definition documentation
[poolifier.git] / src / pools / selection-strategies / least-used-worker-choice-strategy.ts
index 85e145a041b7868bc96565091a0beec16b7b6d89..d9e3c20e1d56e951238cdbfc47ab2c4698ca999a 100644 (file)
@@ -27,7 +27,7 @@ export class LeastUsedWorkerChoiceStrategy<
     opts: WorkerChoiceStrategyOptions = DEFAULT_WORKER_CHOICE_STRATEGY_OPTIONS
   ) {
     super(pool, opts)
-    this.setRequiredStatistics(this.opts)
+    this.setTaskStatistics(this.opts)
   }
 
   /** @inheritDoc */
@@ -50,7 +50,7 @@ export class LeastUsedWorkerChoiceStrategy<
     let leastUsedWorkerNodeKey!: number
     for (const [workerNodeKey, workerNode] of this.pool.workerNodes.entries()) {
       const tasksUsage = workerNode.tasksUsage
-      const workerTasks = tasksUsage.run + tasksUsage.running
+      const workerTasks = tasksUsage.ran + tasksUsage.running
       if (workerTasks === 0) {
         return workerNodeKey
       } else if (workerTasks < minNumberOfTasks) {