From: Jérôme Benoit Date: Thu, 17 Aug 2023 17:35:20 +0000 (+0200) Subject: fix: fix listTaskFunctions() reliabilty on the pool side X-Git-Tag: v2.6.29~24 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=f2dbbf95238f98533a856bf4f30a1187cae5af76;p=poolifier.git fix: fix listTaskFunctions() reliabilty on the pool side Signed-off-by: Jérôme Benoit --- diff --git a/src/pools/abstract-pool.ts b/src/pools/abstract-pool.ts index f89af5ac..cba92d11 100644 --- a/src/pools/abstract-pool.ts +++ b/src/pools/abstract-pool.ts @@ -646,14 +646,15 @@ export abstract class AbstractPool< /** @inheritDoc */ public listTaskFunctions (): string[] { - if ( - Array.isArray(this.getWorkerInfo(0).taskFunctions) && - (this.getWorkerInfo(0).taskFunctions as string[]).length > 0 - ) { - return this.getWorkerInfo(0).taskFunctions as string[] - } else { - return [] + for (const workerNode of this.workerNodes) { + if ( + Array.isArray(workerNode.info.taskFunctions) && + workerNode.info.taskFunctions.length > 0 + ) { + return workerNode.info.taskFunctions + } } + return [] } /** @inheritDoc */