fix: fix possible null exception at handling task execution response
[poolifier.git] / src / pools / thread / dynamic.ts
index a34f0c25f78b1da3a306c9c07edb5c5d43f0f21b..6def273e24bcc413a880ad8fa793fad74a9e36d5 100644 (file)
@@ -1,5 +1,7 @@
-import { type PoolType, PoolTypes } from '../pool'
-import { FixedThreadPool, type ThreadPoolOptions } from './fixed'
+import { type Worker } from 'node:worker_threads'
+import { type PoolOptions, type PoolType, PoolTypes } from '../pool'
+import { checkDynamicPoolSize } from '../utils'
+import { FixedThreadPool } from './fixed'
 
 /**
  * A thread pool with a dynamic number of threads, but a guaranteed minimum number of threads.
@@ -28,10 +30,10 @@ export class DynamicThreadPool<
     min: number,
     protected readonly max: number,
     filePath: string,
-    opts: ThreadPoolOptions = {}
+    opts: PoolOptions<Worker> = {}
   ) {
     super(min, filePath, opts)
-    this.checkDynamicPoolSize(this.numberOfWorkers, this.max)
+    checkDynamicPoolSize(this.numberOfWorkers, this.max)
   }
 
   /** @inheritDoc */