- public choose (): number {
- const chosenWorkerNodeKey = this.nextWorkerNodeKey
- do {
- this.weightedRoundRobinNextWorkerNodeKey()
- } while (!this.isWorkerNodeEligible(this.nextWorkerNodeKey))
- return chosenWorkerNodeKey
+ public choose (): number | undefined {
+ this.setPreviousWorkerNodeKey(this.nextWorkerNodeKey)
+ return this.weightedRoundRobinNextWorkerNodeKey()