refactor: limit pool internals public exposure
[poolifier.git] / src / pools / cluster / dynamic.ts
index eb2b996571f665ff14154cf338c387c5dfa28266..eb86ba853170f5edc83a7bd181e5fb9c45b172d5 100644 (file)
@@ -1,6 +1,5 @@
-import { PoolType } from '../pool'
-import type { ClusterPoolOptions } from './fixed'
-import { FixedClusterPool } from './fixed'
+import { type PoolType, PoolTypes } from '../pool'
+import { type ClusterPoolOptions, FixedClusterPool } from './fixed'
 
 /**
  * A cluster pool with a dynamic number of workers, but a guaranteed minimum number of workers.
@@ -27,7 +26,7 @@ export class DynamicClusterPool<
    */
   public constructor (
     min: number,
-    public readonly max: number,
+    protected readonly max: number,
     filePath: string,
     opts: ClusterPoolOptions = {}
   ) {
@@ -35,18 +34,18 @@ export class DynamicClusterPool<
   }
 
   /** @inheritDoc */
-  public get type (): PoolType {
-    return PoolType.DYNAMIC
+  protected get type (): PoolType {
+    return PoolTypes.dynamic
   }
 
   /** @inheritDoc */
-  public get size (): number {
+  protected get maxSize (): number {
     return this.max
   }
 
   /** @inheritDoc */
   protected get full (): boolean {
-    return this.workerNodes.length === this.max
+    return this.workerNodes.length >= this.max
   }
 
   /** @inheritDoc */