build(deps-dev): apply updates
[poolifier.git] / src / pools / thread / fixed.ts
index 881e37f636eb3a5ba4770c0c7b90cbb994ab029e..c9145f571186a9d5783531236414aff7eadd463e 100644 (file)
@@ -6,13 +6,8 @@ import {
 } from 'node:worker_threads'
 import type { MessageValue } from '../../utility-types'
 import { AbstractPool } from '../abstract-pool'
-import {
-  type PoolOptions,
-  type PoolType,
-  PoolTypes,
-  type WorkerType,
-  WorkerTypes
-} from '../pool'
+import { type PoolOptions, type PoolType, PoolTypes } from '../pool'
+import { type WorkerType, WorkerTypes } from '../worker'
 
 /**
  * Options for a poolifier thread pool.
@@ -29,8 +24,6 @@ export interface ThreadPoolOptions extends PoolOptions<Worker> {
 /**
  * A thread pool with a fixed number of threads.
  *
- * It is possible to perform tasks in sync or asynchronous mode as you prefer.
- *
  * @typeParam Data - Type of data sent to the worker. This can only be structured-cloneable data.
  * @typeParam Response - Type of execution response. This can only be structured-cloneable data.
  * @author [Alessandro Pio Ardizio](https://github.com/pioardi)
@@ -62,7 +55,7 @@ export class FixedThreadPool<
 
   /** @inheritDoc */
   protected async destroyWorker (worker: Worker): Promise<void> {
-    this.sendToWorker(worker, { kill: 1 })
+    this.sendToWorker(worker, { kill: true, workerId: worker.threadId })
     await worker.terminate()
   }