docs: add scope on pool public API
[poolifier.git] / src / pools / selection-strategies / least-busy-worker-choice-strategy.ts
index dabad6826568c38621c73d8fa4f6ac4efb28418f..9a1550e06f60dfecc4339f56ac2c01ad3a7344cf 100644 (file)
@@ -61,8 +61,7 @@ export class LeastBusyWorkerChoiceStrategy<
 
   /** @inheritDoc */
   public choose (): number {
-    this.leastBusyNextWorkerNodeKey()
-    return this.nextWorkerNodeKey
+    return this.leastBusyNextWorkerNodeKey()
   }
 
   /** @inheritDoc */
@@ -70,7 +69,7 @@ export class LeastBusyWorkerChoiceStrategy<
     return true
   }
 
-  private leastBusyNextWorkerNodeKey (): void {
+  private leastBusyNextWorkerNodeKey (): number {
     let minTime = Infinity
     for (const [workerNodeKey, workerNode] of this.pool.workerNodes.entries()) {
       const workerTime =
@@ -87,5 +86,6 @@ export class LeastBusyWorkerChoiceStrategy<
         this.nextWorkerNodeKey = workerNodeKey
       }
     }
+    return this.nextWorkerNodeKey
   }
 }