refactor: silence sonar
[poolifier.git] / src / pools / thread / dynamic.ts
index cd9d23253a040f44070da2fe0b0504da31aeb283..d3764c285291407d75b1ee293ece40ebbc8c5dfd 100644 (file)
@@ -1,4 +1,4 @@
-import { type PoolType, PoolTypes } from '../pool'
+import { PoolEvents, type PoolType, PoolTypes } from '../pool'
 import { checkDynamicPoolSize } from '../utils'
 import { FixedThreadPool, type ThreadPoolOptions } from './fixed'
 
@@ -38,6 +38,18 @@ export class DynamicThreadPool<
     )
   }
 
+  /** @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