void (this.destroyWorker(worker) as Promise<void>)
}
})
- const workerInfo = this.getWorkerInfo(this.getWorkerNodeKey(worker))
+ const workerInfo = this.getWorkerInfoByWorker(worker)
workerInfo.dynamic = true
if (this.workerChoiceStrategyContext.getStrategyPolicy().useDynamicWorker) {
workerInfo.ready = true
private sendWorkerStartupMessage (worker: Worker): void {
this.sendToWorker(worker, {
ready: false,
- workerId: this.getWorkerInfo(this.getWorkerNodeKey(worker)).id as number
+ workerId: this.getWorkerInfoByWorker(worker).id as number
})
}
}
private handleWorkerReadyResponse (message: MessageValue<Response>): void {
- const worker = this.getWorkerById(message.workerId)
- this.getWorkerInfo(this.getWorkerNodeKey(worker as Worker)).ready =
- message.ready as boolean
+ this.getWorkerInfoByWorker(
+ this.getWorkerById(message.workerId) as Worker
+ ).ready = message.ready as boolean
if (this.emitter != null && this.ready) {
this.emitter.emit(PoolEvents.ready, this.info)
}
}
/**
- * Gets the worker information.
+ * Gets the worker information from the given worker node key.
*
* @param workerNodeKey - The worker node key.
*/
return this.workerNodes[workerNodeKey].info
}
+ /**
+ * Gets the worker information from the given worker.
+ *
+ * @param worker - The worker.
+ */
+ private getWorkerInfoByWorker (worker: Worker): WorkerInfo {
+ return this.workerNodes[this.getWorkerNodeKey(worker)].info
+ }
+
/**
* Adds the given worker in the pool worker nodes.
*
elu: this.workerChoiceStrategyContext.getTaskStatisticsRequirements()
.elu.aggregate
},
- workerId: this.getWorkerInfo(this.getWorkerNodeKey(worker)).id as number
+ workerId: this.getWorkerInfoByWorker(worker).id as number
})
}
}