fix: properly handle dynamic pool with zero minimum size
[poolifier.git] / src / pools / cluster / dynamic.ts
index 8ef11c00d8975f38cded441e0ac4a42a639e9116..564dbf54a91adec20804bc5598e800e8301e930a 100644 (file)
@@ -41,7 +41,10 @@ export class DynamicClusterPool<
 
   /** @inheritDoc */
   protected shallCreateDynamicWorker (): boolean {
-    return !this.full && this.internalBusy()
+    return (
+      (!this.full && this.internalBusy()) ||
+      (this.minimumNumberOfWorkers === 0 && this.workerNodes.length === 0)
+    )
   }
 
   /** @inheritDoc */