- this.decreaseWorkerRunningTasks(promise.worker)
- this.stepWorkerRunTasks(promise.worker, 1)
- this.updateWorkerTasksRunTime(promise.worker, message.taskRunTime)
- }
-
- /**
- * Removes the given worker from the pool.
- *
- * @param worker Worker that will be removed.
- */
- protected removeWorker (worker: Worker): void {
- // Clean worker from data structure
- this.workers.splice(this.getWorkerIndex(worker), 1)
- this.removeWorkerTasksUsage(worker)
+ const workerTasksUsage = this.getWorkerTasksUsage(worker) as TasksUsage
+ --workerTasksUsage.running
+ ++workerTasksUsage.run
+ if (message.error != null) {
+ ++workerTasksUsage.error
+ }
+ if (this.workerChoiceStrategyContext.getRequiredStatistics().runTime) {
+ workerTasksUsage.runTime += message.taskRunTime ?? 0
+ if (
+ this.workerChoiceStrategyContext.getRequiredStatistics().avgRunTime &&
+ workerTasksUsage.run !== 0
+ ) {
+ workerTasksUsage.avgRunTime =
+ workerTasksUsage.runTime / workerTasksUsage.run
+ }
+ }