perf: add dynamic thread pool to continuous benchmark
[poolifier.git] / src / pools / abstract-pool.ts
index 69df163bb5775d7ee1c38fe2c8ebd4594ced165e..9aa6ec3dfeab90f8ba462920290f8a7b74b91f80 100644 (file)
@@ -68,8 +68,7 @@ export abstract class AbstractPool<
   public readonly emitter?: PoolEmitter
 
   /**
-   * The task execution response promise map.
-   *
+   * The task execution response promise map:
    * - `key`: The message id of each submitted task.
    * - `value`: An object that contains the worker, the execution response promise resolve and reject callbacks.
    *
@@ -662,7 +661,7 @@ export abstract class AbstractPool<
       ...{
         size: Math.pow(this.maxSize, 2),
         concurrency: 1,
-        tasksStealing: true,
+        taskStealing: true,
         tasksStealingOnBackPressure: true
       },
       ...tasksQueueOptions
@@ -700,14 +699,13 @@ export abstract class AbstractPool<
               (this.opts.tasksQueueOptions?.concurrency as number)
         ) === -1
       )
-    } else {
-      return (
-        this.workerNodes.findIndex(
-          workerNode =>
-            workerNode.info.ready && workerNode.usage.tasks.executing === 0
-        ) === -1
-      )
     }
+    return (
+      this.workerNodes.findIndex(
+        workerNode =>
+          workerNode.info.ready && workerNode.usage.tasks.executing === 0
+      ) === -1
+    )
   }
 
   /** @inheritDoc */
@@ -1170,7 +1168,7 @@ export abstract class AbstractPool<
     // Send the statistics message to worker.
     this.sendStatisticsMessageToWorker(workerNodeKey)
     if (this.opts.enableTasksQueue === true) {
-      if (this.opts.tasksQueueOptions?.tasksStealing === true) {
+      if (this.opts.tasksQueueOptions?.taskStealing === true) {
         this.workerNodes[workerNodeKey].onEmptyQueue =
           this.taskStealingOnEmptyQueue.bind(this)
       }