X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fpools%2Fcluster%2Fdynamic.ts;h=9f2f0dd95130a37d4bf010b071dbcc30271ab9ac;hb=6a5f7992e88975427ab30dcd774b86a0127c5bdd;hp=b93d7e87c4290a21b8a9b8f7c2845647d05592da;hpb=16f3605c35d8a2ef293a4382c6e846dc27915b4a;p=poolifier.git diff --git a/src/pools/cluster/dynamic.ts b/src/pools/cluster/dynamic.ts index b93d7e87..9f2f0dd9 100644 --- a/src/pools/cluster/dynamic.ts +++ b/src/pools/cluster/dynamic.ts @@ -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 = {} ) { - super(min, filePath, opts) - this.checkDynamicPoolSize(this.numberOfWorkers, this.max) + super(min, filePath, opts, max) + checkDynamicPoolSize( + this.minimumNumberOfWorkers, + this.maximumNumberOfWorkers as number + ) } /** @inheritDoc */