Merge branch 'feature/task-functions' of github.com:poolifier/poolifier into feature...
authorJérôme Benoit <jerome.benoit@piment-noir.org>
Mon, 18 Sep 2023 20:19:28 +0000 (22:19 +0200)
committerJérôme Benoit <jerome.benoit@piment-noir.org>
Mon, 18 Sep 2023 20:19:28 +0000 (22:19 +0200)
CHANGELOG.md
src/pools/abstract-pool.ts
src/utility-types.ts
tests/pools/abstract/abstract-pool.test.js

index 5f5bda97d82de1e7cf6666d1b1ca181af06e4bdd..b6ba6fba70f58830691c9da795caedaf51595354 100644 (file)
@@ -17,7 +17,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 
 ### Added
 
-- Add `addTaskFunction()`, `removeTaskFunction()`, `setDefaultTaskFunction()` methods to pool API.
+- Add `hasTaskFunction()`, `addTaskFunction()`, `removeTaskFunction()`, `setDefaultTaskFunction()` methods to pool API.
 - Stricter worker constructor arguments validation.
 
 ## [2.6.45] - 2023-09-17
index 7be2cef51c8f11646b5f43174de7abe3ea43a82c..779d2b59017c4493d3e4dba12f71ae347f6b1ba6 100644 (file)
@@ -860,7 +860,7 @@ export abstract class AbstractPool<
   public async removeTaskFunction (name: string): Promise<boolean> {
     if (!this.taskFunctions.has(name)) {
       throw new Error(
-        'Cannot remove a task function that does not exist on the pool side'
+        'Cannot remove a task function not handled on the pool side'
       )
     }
     this.taskFunctions.delete(name)
index 3817515a585120bb8e8c3c369dc57e1c59ac0c65..48988c089f6717e1e4108143ce87c20bdc5536d1 100644 (file)
@@ -119,7 +119,7 @@ export interface MessageValue<Data = unknown, ErrorData = unknown>
   /**
    * Task function operation:
    * - `'add'` - Add a task function.
-   * - `'delete'` - Delete a task function.
+   * - `'remove'` - Remove a task function.
    * - `'default'` - Set a task function as default.
    */
   readonly taskFunctionOperation?: 'add' | 'remove' | 'default'
index 5c27a4b6e35469dfccc8bc71600a147dd0ac3475..e9cca73255a77681fb76a4d3bb97e0590399c14e 100644 (file)
@@ -1319,9 +1319,7 @@ describe('Abstract pool test suite', () => {
     await expect(
       dynamicThreadPool.removeTaskFunction('test')
     ).rejects.toThrowError(
-      new Error(
-        'Cannot remove a task function that does not exist on the pool side'
-      )
+      new Error('Cannot remove a task function not handled on the pool side')
     )
     const echoTaskFunction = data => {
       return data