X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;ds=sidebyside;f=src%2Fpools%2Fselection-strategies%2Fleast-elu-worker-choice-strategy.ts;h=938d2072e998eed7ac26deeb225662ad884217b8;hb=b9da9d7e74c720f83482a09d1b883fc83d04f4ed;hp=00919f33f58f5878fd381692bfb2009f2c5b611c;hpb=fce028d66b18a0e46571eb82457055fe3177d702;p=poolifier.git diff --git a/src/pools/selection-strategies/least-elu-worker-choice-strategy.ts b/src/pools/selection-strategies/least-elu-worker-choice-strategy.ts index 00919f33..938d2072 100644 --- a/src/pools/selection-strategies/least-elu-worker-choice-strategy.ts +++ b/src/pools/selection-strategies/least-elu-worker-choice-strategy.ts @@ -70,15 +70,15 @@ export class LeastEluWorkerChoiceStrategy< let minWorkerElu = Infinity let chosenWorkerNodeKey: number | undefined for (const [workerNodeKey, workerNode] of this.pool.workerNodes.entries()) { + if (!this.isWorkerNodeEligible(workerNodeKey)) { + continue + } const workerUsage = workerNode.usage const workerElu = workerUsage.elu?.active?.aggregate ?? 0 - if (this.isWorkerNodeEligible(workerNodeKey) && workerElu === 0) { + if (workerElu === 0) { chosenWorkerNodeKey = workerNodeKey break - } else if ( - this.isWorkerNodeEligible(workerNodeKey) && - workerElu < minWorkerElu - ) { + } else if (workerElu < minWorkerElu) { minWorkerElu = workerElu chosenWorkerNodeKey = workerNodeKey }