build: update volta node.js version
[poolifier.git] / src / pools / selection-strategies / least-busy-worker-choice-strategy.ts
index dc304c89fd1e5abecb680aa5d519d9a59f6f18ac..84476eedaf0c434f5bcce23aa7ca694f1bf9d267 100644 (file)
@@ -57,6 +57,11 @@ export class LeastBusyWorkerChoiceStrategy<
 
   /** @inheritDoc */
   public update (): boolean {
+    return true
+  }
+
+  /** @inheritDoc */
+  public choose (): number {
     let minTime = Infinity
     for (const [workerNodeKey, workerNode] of this.pool.workerNodes.entries()) {
       const workerTime =
@@ -64,17 +69,12 @@ export class LeastBusyWorkerChoiceStrategy<
         workerNode.workerUsage.waitTime.aggregate
       if (workerTime === 0) {
         this.nextWorkerNodeId = workerNodeKey
-        return true
+        break
       } else if (workerTime < minTime) {
         minTime = workerTime
         this.nextWorkerNodeId = workerNodeKey
       }
     }
-    return true
-  }
-
-  /** @inheritDoc */
-  public choose (): number {
     return this.nextWorkerNodeId
   }