X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fpools%2Fselection-strategies%2Ffair-share-worker-choice-strategy.ts;h=fc4bd1fd4de4f281c8dbae20fcf3014ca0a5565f;hb=9fe8fd698590c2494dc6793cfd8c08026fe88a31;hp=bc8f8b48746ebf185503455241e94d42e8600552;hpb=46e29227a97fe04f886969199f1c14338af50543;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 bc8f8b48..fc4bd1fd 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 | undefined { - const chosenWorkerNodeKey = this.fairShareNextWorkerNodeKey() - this.assignChosenWorkerNodeKey(chosenWorkerNodeKey) + this.nextWorkerNodeKey = this.fairShareNextWorkerNodeKey() return this.nextWorkerNodeKey } @@ -85,15 +84,15 @@ export class FairShareWorkerChoiceStrategy< let minWorkerVirtualTaskEndTimestamp = Infinity let chosenWorkerNodeKey: number | undefined for (const [workerNodeKey] of this.pool.workerNodes.entries()) { + if (!this.isWorkerNodeEligible(workerNodeKey)) { + continue + } if (this.workersVirtualTaskEndTimestamp[workerNodeKey] == null) { this.computeWorkerVirtualTaskEndTimestamp(workerNodeKey) } const workerVirtualTaskEndTimestamp = this.workersVirtualTaskEndTimestamp[workerNodeKey] - if ( - this.isWorkerNodeEligible(workerNodeKey) && - workerVirtualTaskEndTimestamp < minWorkerVirtualTaskEndTimestamp - ) { + if (workerVirtualTaskEndTimestamp < minWorkerVirtualTaskEndTimestamp) { minWorkerVirtualTaskEndTimestamp = workerVirtualTaskEndTimestamp chosenWorkerNodeKey = workerNodeKey }