/** {@inheritDoc} */
public choose (): Worker {
- const chosenWorker = this.pool.workers.get(this.currentWorkerId)
- ?.worker as Worker
+ const chosenWorker = this.pool.workers[this.currentWorkerId]?.worker
if (this.isDynamicPool && !this.workersTaskRunTime.has(chosenWorker)) {
this.initWorkerTaskRunTime(chosenWorker)
}
)
} else {
this.currentWorkerId =
- this.currentWorkerId === this.pool.workers.size - 1
+ this.currentWorkerId === this.pool.workers.length - 1
? 0
: this.currentWorkerId + 1
this.setWorkerTaskRunTime(
- this.pool.workers.get(this.currentWorkerId)?.worker as Worker,
+ this.pool.workers[this.currentWorkerId]?.worker,
workerTaskWeight,
0
)
}
private initWorkersTaskRunTime (): void {
- for (const value of this.pool.workers.values()) {
- this.initWorkerTaskRunTime(value.worker)
+ for (const workerItem of this.pool.workers) {
+ this.initWorkerTaskRunTime(workerItem.worker)
}
}