build(deps-dev): apply updates
[poolifier.git] / src / pools / cluster / dynamic.ts
index 75296f7a1a894d45b51b65727610f53f361d6fc9..9f2f0dd95130a37d4bf010b071dbcc30271ab9ac 100644 (file)
@@ -1,5 +1,7 @@
-import { type PoolType, PoolTypes } from '../pool'
-import { type ClusterPoolOptions, FixedClusterPool } from './fixed'
+import { type Worker } from 'node:cluster'
+import { type PoolOptions, type PoolType, PoolTypes } from '../pool'
+import { checkDynamicPoolSize } from '../utils'
+import { FixedClusterPool } from './fixed'
 
 /**
  * A cluster pool with a dynamic number of workers, but a guaranteed minimum number of workers.
@@ -26,12 +28,15 @@ export class DynamicClusterPool<
    */
   public constructor (
     min: number,
-    protected readonly max: number,
+    max: number,
     filePath: string,
-    opts: ClusterPoolOptions = {}
+    opts: PoolOptions<Worker> = {}
   ) {
-    super(min, filePath, opts)
-    this.checkDynamicPoolSize(this.numberOfWorkers, this.max)
+    super(min, filePath, opts, max)
+    checkDynamicPoolSize(
+      this.minimumNumberOfWorkers,
+      this.maximumNumberOfWorkers as number
+    )
   }
 
   /** @inheritDoc */
@@ -39,11 +44,6 @@ export class DynamicClusterPool<
     return PoolTypes.dynamic
   }
 
-  /** @inheritDoc */
-  protected get maxSize (): number {
-    return this.max
-  }
-
   /** @inheritDoc */
   protected get busy (): boolean {
     return this.full && this.internalBusy()