X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fpools%2Fcluster%2Fdynamic.ts;h=9f2f0dd95130a37d4bf010b071dbcc30271ab9ac;hb=30d7f6e094a9b837fd85c74ef23188ab28e86644;hp=a9ccd6977255bcadc43bee150d8684a3ee3ad75e;hpb=e102732c0e3966b81834b2c0bdd087eb051162ad;p=poolifier.git diff --git a/src/pools/cluster/dynamic.ts b/src/pools/cluster/dynamic.ts index a9ccd697..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,11 +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) + super(min, filePath, opts, max) + checkDynamicPoolSize( + this.minimumNumberOfWorkers, + this.maximumNumberOfWorkers as number + ) } /** @inheritDoc */ @@ -38,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()