+ private initTaskFunctionWorkerUsage (name: string): WorkerUsage {
+ const getTaskFunctionQueueSize = (): number => {
+ let taskFunctionQueueSize = 0
+ for (const task of this.tasksQueue) {
+ if (
+ (task.name === DEFAULT_TASK_NAME &&
+ name === (this.info.taskFunctions as string[])[1]) ||
+ (task.name !== DEFAULT_TASK_NAME && name === task.name)
+ ) {
+ ++taskFunctionQueueSize
+ }
+ }
+ return taskFunctionQueueSize
+ }
+ return {
+ tasks: {
+ executed: 0,
+ executing: 0,
+ get queued (): number {
+ return getTaskFunctionQueueSize()
+ },
+ failed: 0
+ },
+ runTime: {
+ history: new CircularArray()
+ },
+ waitTime: {
+ history: new CircularArray()
+ },
+ elu: {
+ idle: {
+ history: new CircularArray()
+ },
+ active: {
+ history: new CircularArray()
+ }
+ }
+ }
+ }
+