Merge branch 'master' of github.com:poolifier/poolifier into feature/task-functions
authorJérôme Benoit <jerome.benoit@piment-noir.org>
Sat, 16 Sep 2023 21:46:02 +0000 (23:46 +0200)
committerJérôme Benoit <jerome.benoit@piment-noir.org>
Sat, 16 Sep 2023 21:46:02 +0000 (23:46 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
1  2 
CHANGELOG.md
docs/api.md
src/pools/abstract-pool.ts
src/pools/pool.ts
src/pools/worker-node.ts
tests/pools/abstract/abstract-pool.test.js

diff --cc CHANGELOG.md
index f1857ed75645b87a41162fd8ef8317dd9288d7e2,f40bbb4f299608631aeb934920e6d34d5df26510..852f5693e1aac978bbf9451764f598f546d4eaa2
@@@ -10,12 -10,13 +10,18 @@@ and this project adheres to [Semantic V
  ### Changed
  
  - Disable publication on GitHub packages registry on release until authentication issue is fixed.
 +- Rename `listTaskFunctions()` to `listTaskFunctionNames()` in pool and worker API.
 +
 +### Added
 +
 +- Add `addTaskFunction()`, `removeTaskFunction()`, `setDefaultTaskFunction()` methods to pool API.
  
+ ### Added
+ - Add `startWorkers` to pool options to whether start the minimum number of workers at pool creation or not.
+ - Add `taskStealing` and `tasksStealingOnPressure` to tasks queue options to whether enable task 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
  
  ### Fixed
diff --cc docs/api.md
index ad8ede83926db63389c9f8640d3036bc99815703,7939123b1e64b0bcbe5c75103aeb3f93a47ba830..20d10edf90313edc75259739a5995849bddcb250
@@@ -6,8 -6,9 +6,9 @@@
    - [`pool = new FixedThreadPool/FixedClusterPool(numberOfThreads/numberOfWorkers, filePath, opts)`](#pool--new-fixedthreadpoolfixedclusterpoolnumberofthreadsnumberofworkers-filepath-opts)
    - [`pool = new DynamicThreadPool/DynamicClusterPool(min, max, filePath, opts)`](#pool--new-dynamicthreadpooldynamicclusterpoolmin-max-filepath-opts)
    - [`pool.execute(data, name, transferList)`](#poolexecutedata-name-transferlist)
+   - [`pool.start()`](#poolstart)
    - [`pool.destroy()`](#pooldestroy)
 -  - [`pool.listTaskFunctions()`](#poollisttaskfunctions)
 +  - [`pool.listTaskFunctionNames()`](#poollisttaskfunctionnames)
    - [`PoolOptions`](#pooloptions)
      - [`ThreadPoolOptions extends PoolOptions`](#threadpooloptions-extends-pooloptions)
      - [`ClusterPoolOptions extends PoolOptions`](#clusterpooloptions-extends-pooloptions)
index e122e88180bce90a32710f0d8f6bd8537d57b8b9,fb1bf8458ad7a970f27ae7a4dcbb300faf5bf848..6761882589bb14bd9d205c33684ac7e7b3ab5128
@@@ -92,17 -92,6 +92,13 @@@ export abstract class AbstractPool
     */
    protected readonly max?: number
  
-   /**
-    * Whether the pool is starting or not.
-    */
-   private readonly starting: boolean
 +  /**
 +   * The task functions added at runtime map:
 +   * - `key`: The task function name.
 +   * - `value`: The task function itself.
 +   */
 +  private readonly taskFunctions: Map<string, TaskFunction<Data, Response>>
 +
    /**
     * Whether the pool is started or not.
     */
  
      this.setupHook()
  
-     this.starting = true
-     this.startPool()
 +    this.taskFunctions = new Map<string, TaskFunction<Data, Response>>()
 +
+     this.started = false
      this.starting = false
-     this.started = true
+     if (this.opts.startWorkers === true) {
+       this.start()
+     }
  
      this.startTimestamp = performance.now()
    }
Simple merge
Simple merge