### 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
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)
/**
* 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'
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