X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fpools%2Fcluster%2Fdynamic.ts;h=08ebc75c76a66ba5ca311c2e269988d741ad5aff;hb=d087803425ae5b3577028029dd1d2dae67d7f63b;hp=9636b423915fc670c9b42f24680cee131f343c3a;hpb=2889bd70182e9e42c75d686ece3c288307e01d4f;p=poolifier.git diff --git a/src/pools/cluster/dynamic.ts b/src/pools/cluster/dynamic.ts index 9636b423..08ebc75c 100644 --- a/src/pools/cluster/dynamic.ts +++ b/src/pools/cluster/dynamic.ts @@ -1,5 +1,5 @@ import { checkDynamicPoolSize } from '../utils' -import { type PoolType, PoolTypes } from '../pool' +import { PoolEvents, type PoolType, PoolTypes } from '../pool' import { type ClusterPoolOptions, FixedClusterPool } from './fixed' /** @@ -38,6 +38,18 @@ export class DynamicClusterPool< ) } + /** @inheritDoc */ + protected shallCreateDynamicWorker (): boolean { + return !this.full && this.internalBusy() + } + + /** @inheritDoc */ + protected checkAndEmitDynamicWorkerCreationEvents (): void { + if (this.full) { + this.emitter?.emit(PoolEvents.full, this.info) + } + } + /** @inheritDoc */ protected get type (): PoolType { return PoolTypes.dynamic