fix: fix listTaskFunctions() reliabilty on the pool side
authorJérôme Benoit <jerome.benoit@sap.com>
Thu, 17 Aug 2023 17:35:20 +0000 (19:35 +0200)
committerJérôme Benoit <jerome.benoit@sap.com>
Thu, 17 Aug 2023 17:35:20 +0000 (19:35 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
src/pools/abstract-pool.ts

index f89af5acf813afc18eeaaa1b9277039c6692e480..cba92d11f4ed684e8043bb43800cf7351b35a9c0 100644 (file)
@@ -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 */