fix: fix worker choice strategy retries mechanism on some edge cases
[poolifier.git] / src / pools / abstract-pool.ts
index 183344f84b42a2a55411788d1d414fb82383f9dc..59466274bd8c5740047b91e0c8b9936e3c4b3c8b 100644 (file)
@@ -952,7 +952,7 @@ export abstract class AbstractPool<
     if (this.shallCreateDynamicWorker()) {
       const workerNodeKey = this.createAndSetupDynamicWorkerNode()
       if (
-        this.workerChoiceStrategyContext.getStrategyPolicy().useDynamicWorker
+        this.workerChoiceStrategyContext.getStrategyPolicy().dynamicWorkerUsage
       ) {
         return workerNodeKey
       }
@@ -1062,7 +1062,10 @@ export abstract class AbstractPool<
       workerId: workerInfo.id as number
     })
     workerInfo.dynamic = true
-    if (this.workerChoiceStrategyContext.getStrategyPolicy().useDynamicWorker) {
+    if (
+      this.workerChoiceStrategyContext.getStrategyPolicy().dynamicWorkerReady ||
+      this.workerChoiceStrategyContext.getStrategyPolicy().dynamicWorkerUsage
+    ) {
       workerInfo.ready = true
     }
     this.checkAndEmitDynamicWorkerCreationEvents()