X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fpools%2Fworker-node.ts;h=78756560c0fbaa78fedb96aad7153a21d14e61ff;hb=e81c38f2f8046e9a482e94040b8f6d31dcda160c;hp=387d05f964270545b5b92f0e841768dea20a23df;hpb=5b49e86408b36f63d5076a086e2feca64a9690d0;p=poolifier.git diff --git a/src/pools/worker-node.ts b/src/pools/worker-node.ts index 387d05f9..78756560 100644 --- a/src/pools/worker-node.ts +++ b/src/pools/worker-node.ts @@ -13,6 +13,7 @@ import { Deque } from '../deque' import { type IWorker, type IWorkerNode, + type StrategyData, type WorkerInfo, type WorkerNodeEventCallback, type WorkerType, @@ -35,6 +36,8 @@ implements IWorkerNode { /** @inheritdoc */ public usage: WorkerUsage /** @inheritdoc */ + public strategyData?: StrategyData + /** @inheritdoc */ public messageChannel?: MessageChannel /** @inheritdoc */ public tasksQueueBackPressureSize: number @@ -136,21 +139,21 @@ implements IWorkerNode { /** @inheritdoc */ public getTaskFunctionWorkerUsage (name: string): WorkerUsage | undefined { - if (!Array.isArray(this.info.taskFunctions)) { + if (!Array.isArray(this.info.taskFunctionNames)) { throw new Error( `Cannot get task function worker usage for task function name '${name}' when task function names list is not yet defined` ) } if ( - Array.isArray(this.info.taskFunctions) && - this.info.taskFunctions.length < 3 + Array.isArray(this.info.taskFunctionNames) && + this.info.taskFunctionNames.length < 3 ) { throw new Error( `Cannot get task function worker usage for task function name '${name}' when task function names list has less than 3 elements` ) } if (name === DEFAULT_TASK_NAME) { - name = this.info.taskFunctions[1] + name = this.info.taskFunctionNames[1] } if (!this.taskFunctionsUsage.has(name)) { this.taskFunctionsUsage.set(name, this.initTaskFunctionWorkerUsage(name)) @@ -224,7 +227,7 @@ implements IWorkerNode { for (const task of this.tasksQueue) { if ( (task.name === DEFAULT_TASK_NAME && - name === (this.info.taskFunctions as string[])[1]) || + name === (this.info.taskFunctionNames as string[])[1]) || (task.name !== DEFAULT_TASK_NAME && name === task.name) ) { ++taskFunctionQueueSize