X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fpools%2Fselection-strategies%2Ffair-share-worker-choice-strategy.ts;h=bf30a4764d4ffdd5287fcbbad588baddca42b193;hb=20016c79549983d09d30b70852ec7fae515d4156;hp=00c56dad8f555f64afc0a4d21a693d6a97b956f5;hpb=a2ed505383d2c128bd616a29ffb48a1975174036;p=poolifier.git diff --git a/src/pools/selection-strategies/fair-share-worker-choice-strategy.ts b/src/pools/selection-strategies/fair-share-worker-choice-strategy.ts index 00c56dad..bf30a476 100644 --- a/src/pools/selection-strategies/fair-share-worker-choice-strategy.ts +++ b/src/pools/selection-strategies/fair-share-worker-choice-strategy.ts @@ -70,8 +70,7 @@ export class FairShareWorkerChoiceStrategy< /** @inheritDoc */ public choose (): number { - this.fairShareNextWorkerNodeKey() - return this.nextWorkerNodeKey + return this.fairShareNextWorkerNodeKey() } /** @inheritDoc */ @@ -80,7 +79,7 @@ export class FairShareWorkerChoiceStrategy< return true } - private fairShareNextWorkerNodeKey (): void { + private fairShareNextWorkerNodeKey (): number { let minWorkerVirtualTaskEndTimestamp = Infinity for (const [workerNodeKey] of this.pool.workerNodes.entries()) { if (this.workersVirtualTaskEndTimestamp[workerNodeKey] == null) { @@ -96,6 +95,7 @@ export class FairShareWorkerChoiceStrategy< this.nextWorkerNodeKey = workerNodeKey } } + return this.nextWorkerNodeKey } /**