refactor: untangle utils purpose
[poolifier.git] / src / pools / cluster / fixed.ts
index 545238b0136fc5f0b1ae8d4c43710a302d087f8d..c60266e3d72b623fb9225dcc20882c064d29438c 100644 (file)
@@ -1,8 +1,8 @@
 import cluster, { type Worker } from 'node:cluster'
-import type { MessageValue } from '../../utility-types'
-import { AbstractPool } from '../abstract-pool'
-import { type PoolOptions, type PoolType, PoolTypes } from '../pool'
-import { type WorkerType, WorkerTypes } from '../worker'
+import type { MessageValue } from '../../utility-types.js'
+import { AbstractPool } from '../abstract-pool.js'
+import { type PoolOptions, type PoolType, PoolTypes } from '../pool.js'
+import { type WorkerType, WorkerTypes } from '../worker.js'
 
 /**
  * Options for a poolifier cluster pool.
@@ -54,8 +54,8 @@ export class FixedClusterPool<
   ): void {
     this.workerNodes[workerNodeKey].worker.send({
       ...message,
-      workerId: this.getWorkerInfo(workerNodeKey).id as number
-    })
+      workerId: this.getWorkerInfo(workerNodeKey)?.id
+    } satisfies MessageValue<Data>)
   }
 
   /** @inheritDoc */
@@ -89,6 +89,16 @@ export class FixedClusterPool<
     this.workerNodes[workerNodeKey].worker.off('message', listener)
   }
 
+  /** @inheritDoc */
+  protected shallCreateDynamicWorker (): boolean {
+    return false
+  }
+
+  /** @inheritDoc */
+  protected checkAndEmitDynamicWorkerCreationEvents (): void {
+    /* noop */
+  }
+
   /** @inheritDoc */
   protected get type (): PoolType {
     return PoolTypes.fixed