const promiseResponse = this.promiseResponseMap.get(taskId as string)
if (promiseResponse != null) {
const { resolve, reject, workerNodeKey, asyncResource } = promiseResponse
+ const workerNode = this.workerNodes[workerNodeKey]
if (workerError != null) {
this.emitter?.emit(PoolEvents.taskError, workerError)
asyncResource != null
this.afterTaskExecutionHook(workerNodeKey, message)
this.workerChoiceStrategyContext.update(workerNodeKey)
this.promiseResponseMap.delete(taskId as string)
- this.workerNodes[workerNodeKey].emit('taskFinished', taskId)
+ workerNode.emit('taskFinished', taskId)
if (this.opts.enableTasksQueue === true) {
- const workerNodeTasksUsage = this.workerNodes[workerNodeKey].usage.tasks
+ const workerNodeTasksUsage = workerNode.usage.tasks
if (
this.tasksQueueSize(workerNodeKey) > 0 &&
workerNodeTasksUsage.executing <
this.tasksQueueSize(workerNodeKey) === 0 &&
workerNodeTasksUsage.sequentiallyStolen === 0
) {
- this.workerNodes[workerNodeKey].emit('idleWorkerNode', {
+ workerNode.emit('idleWorkerNode', {
workerId: workerId as number,
workerNodeKey
})