Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
*/
private pushWorkerNode (worker: Worker): number {
const workerNode = new WorkerNode<Worker, Data>(worker, this.worker)
+ // Flag the worker as ready at pool startup.
if (this.starting) {
workerNode.info.ready = true
}
/** @inheritDoc */
public choose (): number {
const chosenWorkerNodeKey = this.nextWorkerNodeKey
- this.roundRobinNextWorkerNodeKey()
+ do {
+ this.roundRobinNextWorkerNodeKey()
+ } while (!this.isWorkerNodeReady(this.nextWorkerNodeKey))
return chosenWorkerNodeKey
}
/** @inheritDoc */
public choose (): number {
const chosenWorkerNodeKey = this.nextWorkerNodeKey
- this.weightedRoundRobinNextWorkerNodeKey()
+ do {
+ this.weightedRoundRobinNextWorkerNodeKey()
+ } while (!this.isWorkerNodeReady(this.nextWorkerNodeKey))
return chosenWorkerNodeKey
}