perf: use a single map to store pool workers and their related data
[poolifier.git] / src / pools / cluster / dynamic.ts
index 513a73c5d7804cfa2e109a5d9cf6c01f4c060945..0a2d0f3879fc6ab44129608fec6d9c6624cd4c1a 100644 (file)
@@ -1,4 +1,3 @@
-import { EMPTY_OBJECT_LITERAL } from '../../utils'
 import { PoolType } from '../pool-internal'
 import type { ClusterPoolOptions } from './fixed'
 import { FixedClusterPool } from './fixed'
@@ -30,7 +29,7 @@ export class DynamicClusterPool<
     min: number,
     protected readonly max: number,
     filePath: string,
-    opts: ClusterPoolOptions = EMPTY_OBJECT_LITERAL
+    opts: ClusterPoolOptions = {}
   ) {
     super(min, filePath, opts)
   }
@@ -42,6 +41,6 @@ export class DynamicClusterPool<
 
   /** {@inheritDoc} */
   public get busy (): boolean {
-    return this.workers.length === this.max
+    return this.workers.size === this.max
   }
 }