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=43b84974f72aecd75b4b592e0009359bd5baf228;hp=00c56dad8f555f64afc0a4d21a693d6a97b956f5;hpb=9b1068374b1a52479b07e1e22b692289d5579237;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 } /**