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