refactor: cleanup task usage method namespace
authorJérôme Benoit <jerome.benoit@sap.com>
Sun, 9 Jul 2023 20:29:26 +0000 (22:29 +0200)
committerJérôme Benoit <jerome.benoit@sap.com>
Sun, 9 Jul 2023 20:29:26 +0000 (22:29 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
src/pools/abstract-pool.ts
src/pools/worker-node.ts
src/pools/worker.ts

index a7f1579fde52512735224c1f47738f8ab7c211f2..615cf29604cdb1b2309b412be1df8f358d09958e 100644 (file)
@@ -672,9 +672,9 @@ export abstract class AbstractPool<
     const workerUsage = this.workerNodes[workerNodeKey].usage
     ++workerUsage.tasks.executing
     this.updateWaitTimeWorkerUsage(workerUsage, task)
-    const tasksWorkerUsage = this.workerNodes[
-      workerNodeKey
-    ].getTasksWorkerUsage(task.name as string) as WorkerUsage
+    const tasksWorkerUsage = this.workerNodes[workerNodeKey].getTaskWorkerUsage(
+      task.name as string
+    ) as WorkerUsage
     ++tasksWorkerUsage.tasks.executing
     this.updateWaitTimeWorkerUsage(tasksWorkerUsage, task)
   }
@@ -695,9 +695,9 @@ export abstract class AbstractPool<
     this.updateTaskStatisticsWorkerUsage(workerUsage, message)
     this.updateRunTimeWorkerUsage(workerUsage, message)
     this.updateEluWorkerUsage(workerUsage, message)
-    const tasksWorkerUsage = this.workerNodes[
-      workerNodeKey
-    ].getTasksWorkerUsage(message.name as string) as WorkerUsage
+    const tasksWorkerUsage = this.workerNodes[workerNodeKey].getTaskWorkerUsage(
+      message.name as string
+    ) as WorkerUsage
     this.updateTaskStatisticsWorkerUsage(tasksWorkerUsage, message)
     this.updateRunTimeWorkerUsage(tasksWorkerUsage, message)
     this.updateEluWorkerUsage(tasksWorkerUsage, message)
index 240f304588e3a369964d143ae3a8180b2aafbdaa..a5cbbbfb98028b4269c1d4c615a70ea7ea0b741b 100644 (file)
@@ -74,7 +74,7 @@ implements IWorkerNode<Worker, Data> {
   }
 
   /** @inheritdoc */
-  public getTasksWorkerUsage (name: string): WorkerUsage | undefined {
+  public getTaskWorkerUsage (name: string): WorkerUsage | undefined {
     if (!this.tasksUsage.has(name)) {
       this.tasksUsage.set(name, this.initTaskWorkerUsage(name))
     }
index 41659adbdbec5b8d6b489d8dbfcb24f0820aff56..7c4a50c81afe9375383db1c9fdb17362b3c92db1 100644 (file)
@@ -266,7 +266,7 @@ export interface IWorkerNode<Worker extends IWorker, Data = unknown> {
    */
   readonly resetUsage: () => void
   /**
-   * Worker node get tasks usage statistics.
+   * Worker node get task usage statistics.
    */
-  readonly getTasksWorkerUsage: (name: string) => WorkerUsage | undefined
+  readonly getTaskWorkerUsage: (name: string) => WorkerUsage | undefined
 }