Removed max tasks (#225)
[poolifier.git] / src / pools / thread / fixed.ts
index 1c91caa752702fefcccecb88074875ea4a27031c..6fec9aa04db6af79c7eac3deae91d09b4d311cd4 100644 (file)
@@ -30,12 +30,12 @@ export class FixedThreadPool<
    *
    * @param numberOfThreads Number of threads for this pool.
    * @param filePath Path to an implementation of a `ThreadWorker` file, which can be relative or absolute.
-   * @param opts Options for this fixed thread pool. Default: `{ maxTasks: 1000 }`
+   * @param opts Options for this fixed thread pool. Default: `{}`
    */
   public constructor (
     numberOfThreads: number,
     filePath: string,
-    opts: PoolOptions<ThreadWorkerWithMessageChannel> = { maxTasks: 1000 }
+    opts: PoolOptions<ThreadWorkerWithMessageChannel> = {}
   ) {
     super(numberOfThreads, filePath, opts)
   }
@@ -78,9 +78,7 @@ export class FixedThreadPool<
     worker.postMessage({ parent: port1 }, [port1])
     worker.port1 = port1
     worker.port2 = port2
-    // We will attach a listener for every task,
-    // when the task is completed the listener will be removed but to avoid warnings we are increasing the max listeners size.
-    worker.port2.setMaxListeners(this.opts.maxTasks ?? 1000)
+    // Listen worker messages.
     this.registerWorkerMessageListener(worker, super.workerListener())
   }
 }