refactor: rename pool option tasksStealing to taskStealing
authorJérôme Benoit <jerome.benoit@piment-noir.org>
Sat, 16 Sep 2023 20:38:52 +0000 (22:38 +0200)
committerJérôme Benoit <jerome.benoit@piment-noir.org>
Sat, 16 Sep 2023 20:38:52 +0000 (22:38 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
CHANGELOG.md
docs/api.md
src/pools/abstract-pool.ts
src/pools/pool.ts
tests/pools/abstract/abstract-pool.test.js

index 6fec036fbc1d8cdb0d34e5f1a5d16d097bff441e..29d771c2c6632f43b01405f6d6ba6153115dc93d 100644 (file)
@@ -14,7 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 ### Added
 
 - Add `startWorkers` to pool options to whether start the minimum number of workers at pool creation or not.
-- Add `tasksStealing` and `tasksStealingOnPressure` to tasks queue options to whether enable tasks stealing or not and whether enable tasks stealing on back pressure or not.
+- Add `taskStealing` and `tasksStealingOnPressure` to tasks queue options to whether enable tasks stealing or not and whether enable tasks stealing on back pressure or not.
 - Continuous internal benchmarking: https://poolifier.github.io/benchmark-results/dev/bench.
 
 ## [2.6.44] - 2023-09-08
index 5a5ffd49bf5c05c4ae70a091d22c0fc9a03729c0..fa15de886611a8e1988dc3c0b36af262c6057994 100644 (file)
@@ -102,10 +102,10 @@ An object with these properties:
 
   - `size` (optional) - The maximum number of tasks that can be queued on a worker before flagging it as back pressured. It must be a positive integer.
   - `concurrency` (optional) - The maximum number of tasks that can be executed concurrently on a worker. It must be a positive integer.
-  - `tasksStealing` (optional) - Tasks stealing enablement.
+  - `taskStealing` (optional) - Tasks stealing enablement.
   - `tasksStealingOnBackPressure` (optional) - Tasks stealing enablement on back pressure.
 
-  Default: `{ size: (pool maximum size)^2, concurrency: 1, tasksStealing: true, tasksStealingOnBackPressure: true }`
+  Default: `{ size: (pool maximum size)^2, concurrency: 1, taskStealing: true, tasksStealingOnBackPressure: true }`
 
 #### `ThreadPoolOptions extends PoolOptions`
 
index 69df163bb5775d7ee1c38fe2c8ebd4594ced165e..fb1bf8458ad7a970f27ae7a4dcbb300faf5bf848 100644 (file)
@@ -662,7 +662,7 @@ export abstract class AbstractPool<
       ...{
         size: Math.pow(this.maxSize, 2),
         concurrency: 1,
-        tasksStealing: true,
+        taskStealing: true,
         tasksStealingOnBackPressure: true
       },
       ...tasksQueueOptions
@@ -1170,7 +1170,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)
       }
index f76be0c0d61bb04632439cf4d96ef6f5959e0e72..b5eec21c714798099076be2dab22f64aec4722ac 100644 (file)
@@ -114,11 +114,11 @@ export interface TasksQueueOptions {
    */
   readonly concurrency?: number
   /**
-   * Whether to enable tasks stealing.
+   * Whether to enable task stealing.
    *
    * @defaultValue true
    */
-  readonly tasksStealing?: boolean
+  readonly taskStealing?: boolean
   /**
    * Whether to enable tasks stealing on back pressure.
    *
index df109fe1982e4c511e40a73b9e5449683a18ae00..719acd766781fed8c6f9c3e46b4cc82d1a3e28a2 100644 (file)
@@ -239,7 +239,7 @@ describe('Abstract pool test suite', () => {
       tasksQueueOptions: {
         concurrency: 2,
         size: 4,
-        tasksStealing: true,
+        taskStealing: true,
         tasksStealingOnBackPressure: true
       },
       workerChoiceStrategy: WorkerChoiceStrategies.LEAST_USED,
@@ -635,7 +635,7 @@ describe('Abstract pool test suite', () => {
     expect(pool.opts.tasksQueueOptions).toStrictEqual({
       concurrency: 1,
       size: 4,
-      tasksStealing: true,
+      taskStealing: true,
       tasksStealingOnBackPressure: true
     })
     pool.enableTasksQueue(true, { concurrency: 2 })
@@ -643,7 +643,7 @@ describe('Abstract pool test suite', () => {
     expect(pool.opts.tasksQueueOptions).toStrictEqual({
       concurrency: 2,
       size: 4,
-      tasksStealing: true,
+      taskStealing: true,
       tasksStealingOnBackPressure: true
     })
     pool.enableTasksQueue(false)
@@ -661,14 +661,14 @@ describe('Abstract pool test suite', () => {
     expect(pool.opts.tasksQueueOptions).toStrictEqual({
       concurrency: 1,
       size: 4,
-      tasksStealing: true,
+      taskStealing: true,
       tasksStealingOnBackPressure: true
     })
     pool.setTasksQueueOptions({ concurrency: 2 })
     expect(pool.opts.tasksQueueOptions).toStrictEqual({
       concurrency: 2,
       size: 4,
-      tasksStealing: true,
+      taskStealing: true,
       tasksStealingOnBackPressure: true
     })
     expect(() =>