/** @inheritDoc */
public choose (): number | undefined {
- let roundId: number = this.roundId
+ let roundId!: number
let workerNodeId: number | undefined
for (
let roundIndex = this.roundId;
workerNodeKey < this.pool.workerNodes.length;
workerNodeKey++
) {
+ if (!this.isWorkerNodeEligible(workerNodeKey)) {
+ continue
+ }
const workerWeight =
this.opts.weights?.[workerNodeKey] ?? this.defaultWorkerWeight
- if (
- this.isWorkerNodeEligible(workerNodeKey) &&
- workerWeight >= this.roundWeights[roundIndex]
- ) {
+ if (workerWeight >= this.roundWeights[roundIndex]) {
workerNodeId = workerNodeKey
break
}