Merge dependabot/npm_and_yarn/examples/typescript/http-server-pool/fastify-hybrid...
[poolifier.git] / src / pools / cluster / fixed.ts
index b1930f2f7f5ec59aa509dcaba578d595d5e6aaad..4a8cb4f1eeeafeb59adf1e30c5d678328cb19b70 100644 (file)
@@ -1,8 +1,9 @@
 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.
@@ -52,10 +53,10 @@ export class FixedClusterPool<
     workerNodeKey: number,
     message: MessageValue<Data>
   ): void {
-    this.workerNodes[workerNodeKey].worker.send({
+    this.workerNodes[workerNodeKey]?.worker.send({
       ...message,
-      workerId: this.getWorkerInfo(workerNodeKey).id as number
-    })
+      workerId: this.getWorkerInfo(workerNodeKey)?.id
+    } satisfies MessageValue<Data>)
   }
 
   /** @inheritDoc */
@@ -95,7 +96,9 @@ export class FixedClusterPool<
   }
 
   /** @inheritDoc */
-  protected checkAndEmitDynamicWorkerCreationEvents (): void {}
+  protected checkAndEmitDynamicWorkerCreationEvents (): void {
+    /* noop */
+  }
 
   /** @inheritDoc */
   protected get type (): PoolType {