fix: fix getWorkerTasksUsage() return type
authorJérôme Benoit <jerome.benoit@sap.com>
Tue, 18 Apr 2023 21:29:05 +0000 (23:29 +0200)
committerJérôme Benoit <jerome.benoit@sap.com>
Tue, 18 Apr 2023 21:29:05 +0000 (23:29 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
src/pools/abstract-pool.ts

index 473789809d2dde4ea57571dd1a2ded5dd7499477..e0feb5edf9925e7bf893ea1916d6f1a84d53565b 100644 (file)
@@ -387,7 +387,7 @@ export abstract class AbstractPool<
     worker: Worker,
     message: MessageValue<Response>
   ): void {
-    const workerTasksUsage = this.getWorkerTasksUsage(worker) as TasksUsage
+    const workerTasksUsage = this.getWorkerTasksUsage(worker)
     --workerTasksUsage.running
     ++workerTasksUsage.run
     if (message.error != null) {
@@ -560,7 +560,7 @@ export abstract class AbstractPool<
    * @throws Error if the worker is not found in the pool worker nodes.
    * @returns The worker tasks usage.
    */
-  private getWorkerTasksUsage (worker: Worker): TasksUsage | undefined {
+  private getWorkerTasksUsage (worker: Worker): TasksUsage {
     const workerNodeKey = this.getWorkerNodeKey(worker)
     if (workerNodeKey !== -1) {
       return this.workerNodes[workerNodeKey].tasksUsage