/** @inheritDoc */
public hasTaskFunction (name: string): boolean {
- this.sendToWorkers({
- taskFunctionOperation: 'has',
- taskFunctionName: name
- })
- return true
+ for (const workerNode of this.workerNodes) {
+ if (
+ Array.isArray(workerNode.info.taskFunctionNames) &&
+ workerNode.info.taskFunctionNames.includes(name)
+ ) {
+ return true
+ }
+ }
+ return false
}
/** @inheritDoc */
readonly taskPerformance?: TaskPerformance
/**
* Task function operation:
- * - `'has'` - Check if a task function exists.
* - `'add'` - Add a task function.
* - `'delete'` - Delete a task function.
* - `'default'` - Set a task function as default.
*/
- readonly taskFunctionOperation?: 'has' | 'add' | 'remove' | 'default'
+ readonly taskFunctionOperation?: 'add' | 'remove' | 'default'
+ /**
+ * Whether the task function operation is successful or not.
+ */
readonly taskFunctionOperationStatus?: boolean
/**
* Task function serialized to string.
): void {
const { taskFunctionOperation, taskFunction, taskFunctionName } = message
let response!: TaskFunctionOperationReturnType
- if (taskFunctionOperation === 'has') {
- response = this.hasTaskFunction(taskFunctionName as string)
- } else if (taskFunctionOperation === 'add') {
+ if (taskFunctionOperation === 'add') {
response = this.addTaskFunction(
taskFunctionName as string,
// eslint-disable-next-line @typescript-eslint/no-implied-eval, no-new-func