Merge dependabot/npm_and_yarn/examples/typescript/http-server-pool/fastify-hybrid...
[poolifier.git] / src / pools / thread / fixed.ts
index d22d75fb3b5a397e8a2371a700d53d4f243160ba..78912c2b03d11537bebce5cc0576d058157321af 100644 (file)
@@ -1,8 +1,9 @@
 import {
+  isMainThread,
   type TransferListItem,
-  type Worker,
-  isMainThread
+  type Worker
 } from 'node:worker_threads'
+
 import type { MessageValue } from '../../utility-types.js'
 import { AbstractPool } from '../abstract-pool.js'
 import { type PoolOptions, type PoolType, PoolTypes } from '../pool.js'
@@ -52,7 +53,7 @@ export class FixedThreadPool<
     message: MessageValue<Data>,
     transferList?: TransferListItem[]
   ): void {
-    this.workerNodes[workerNodeKey].messageChannel?.port1.postMessage(
+    this.workerNodes[workerNodeKey]?.messageChannel?.port1.postMessage(
       {
         ...message,
         workerId: this.getWorkerInfo(workerNodeKey)?.id