From: Jérôme Benoit Date: Tue, 18 Apr 2023 21:29:05 +0000 (+0200) Subject: fix: fix getWorkerTasksUsage() return type X-Git-Tag: v2.4.11~28 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=05ca3d0dda373dd18120487f7517d80051b8e38f;p=poolifier.git fix: fix getWorkerTasksUsage() return type Signed-off-by: Jérôme Benoit --- diff --git a/src/pools/abstract-pool.ts b/src/pools/abstract-pool.ts index 47378980..e0feb5ed 100644 --- a/src/pools/abstract-pool.ts +++ b/src/pools/abstract-pool.ts @@ -387,7 +387,7 @@ export abstract class AbstractPool< worker: Worker, message: MessageValue ): 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