+ private sendToWorkers (message: Omit<MessageValue<Data>, 'workerId'>): number {
+ let messagesCount = 0
+ for (const [workerNodeKey] of this.workerNodes.entries()) {
+ this.sendToWorker(workerNodeKey, {
+ ...message,
+ workerId: this.getWorkerInfo(workerNodeKey).id as number
+ })
+ ++messagesCount
+ }
+ return messagesCount
+ }
+
+ /** @inheritDoc */
+ public hasTaskFunction (name: string): boolean {
+ this.sendToWorkers({
+ taskFunctionOperation: 'has',
+ taskFunctionName: name
+ })
+ return true
+ }
+
+ /** @inheritDoc */
+ public addTaskFunction (name: string, taskFunction: TaskFunction): boolean {
+ this.sendToWorkers({
+ taskFunctionOperation: 'add',
+ taskFunctionName: name,
+ taskFunction: taskFunction.toString()
+ })
+ return true
+ }
+