+
+ private weightedRoundRobinNextWorkerNodeKey (): void {
+ const workerVirtualTaskRunTime = this.workerVirtualTaskRunTime
+ const workerWeight =
+ this.opts.weights?.[this.nextWorkerNodeKey] ?? this.defaultWorkerWeight
+ if (workerVirtualTaskRunTime < workerWeight) {
+ this.workerVirtualTaskRunTime =
+ workerVirtualTaskRunTime +
+ this.getWorkerTaskRunTime(this.nextWorkerNodeKey)
+ } else {
+ this.nextWorkerNodeKey =
+ this.nextWorkerNodeKey === this.pool.workerNodes.length - 1
+ ? 0
+ : this.nextWorkerNodeKey + 1
+ this.workerVirtualTaskRunTime = 0
+ }
+ }