refactor: cleanup worker usage statistics code
authorJérôme Benoit <jerome.benoit@sap.com>
Sat, 19 Aug 2023 18:18:37 +0000 (20:18 +0200)
committerJérôme Benoit <jerome.benoit@sap.com>
Sat, 19 Aug 2023 18:18:37 +0000 (20:18 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
src/pools/abstract-pool.ts

index 428dd9128ca8e26e20d5e766f6cab57b6c04ca2f..1aa1a13413f807019352907d2dac7a635ab665d1 100644 (file)
@@ -819,10 +819,8 @@ export abstract class AbstractPool<
       const taskFunctionWorkerUsage = this.workerNodes[
         workerNodeKey
       ].getTaskFunctionWorkerUsage(task.name as string) as WorkerUsage
-      if (taskFunctionWorkerUsage != null) {
-        ++taskFunctionWorkerUsage.tasks.executing
-        this.updateWaitTimeWorkerUsage(taskFunctionWorkerUsage, task)
-      }
+      ++taskFunctionWorkerUsage.tasks.executing
+      this.updateWaitTimeWorkerUsage(taskFunctionWorkerUsage, task)
     }
   }
 
@@ -846,7 +844,7 @@ export abstract class AbstractPool<
     if (
       this.shallUpdateTaskFunctionWorkerUsage(workerNodeKey) &&
       this.workerNodes[workerNodeKey].getTaskFunctionWorkerUsage(
-        message.taskPerformance?.name ?? DEFAULT_TASK_NAME
+        message.taskPerformance?.name as string
       ) != null
     ) {
       const taskFunctionWorkerUsage = this.workerNodes[