fix: fix fair share algorithm implementation
[poolifier.git] / src / pools / selection-strategies / fair-share-worker-choice-strategy.ts
index 17133408e276191a9f85f1abbdf21209445420ab..e65575a1e05c805978111cbbf279c5f5a5767e6f 100644 (file)
@@ -13,7 +13,7 @@ import type {
  */
 interface WorkerVirtualTaskTimestamp {
   start: number
-  end: number
+  end?: number
 }
 
 /**
@@ -59,10 +59,8 @@ export class FairShareWorkerChoiceStrategy<
   }
 
   /** @inheritDoc */
-  public update (): boolean {
-    for (const [workerNodeKey] of this.pool.workerNodes.entries()) {
-      this.computeWorkerVirtualTaskTimestamp(workerNodeKey)
-    }
+  public update (workerNodeKey: number): boolean {
+    this.computeWorkerVirtualTaskTimestamp(workerNodeKey)
     return true
   }