+ /** @inheritDoc */
+ public get info (): PoolInfo {
+ return {
+ type: this.type,
+ worker: this.worker,
+ minSize: this.minSize,
+ maxSize: this.maxSize,
+ workerNodes: this.workerNodes.length,
+ idleWorkerNodes: this.workerNodes.reduce(
+ (accumulator, workerNode) =>
+ workerNode.workerUsage.tasks.executing === 0
+ ? accumulator + 1
+ : accumulator,
+ 0
+ ),
+ busyWorkerNodes: this.workerNodes.reduce(
+ (accumulator, workerNode) =>
+ workerNode.workerUsage.tasks.executing > 0
+ ? accumulator + 1
+ : accumulator,
+ 0
+ ),
+ executedTasks: this.workerNodes.reduce(
+ (accumulator, workerNode) =>
+ accumulator + workerNode.workerUsage.tasks.executed,
+ 0
+ ),
+ executingTasks: this.workerNodes.reduce(
+ (accumulator, workerNode) =>
+ accumulator + workerNode.workerUsage.tasks.executing,
+ 0
+ ),
+ queuedTasks: this.workerNodes.reduce(
+ (accumulator, workerNode) => accumulator + workerNode.tasksQueue.size,
+ 0
+ ),
+ maxQueuedTasks: this.workerNodes.reduce(
+ (accumulator, workerNode) =>
+ accumulator + workerNode.tasksQueue.maxSize,
+ 0
+ ),
+ failedTasks: this.workerNodes.reduce(
+ (accumulator, workerNode) =>
+ accumulator + workerNode.workerUsage.tasks.failed,
+ 0
+ )
+ }
+ }
+
+ /**
+ * Pool type.
+ *
+ * If it is `'dynamic'`, it provides the `max` property.
+ */
+ protected abstract get type (): PoolType
+
+ /**
+ * Gets the worker type.
+ */
+ protected abstract get worker (): WorkerType
+
+ /**
+ * Pool minimum size.
+ */
+ protected abstract get minSize (): number
+
+ /**
+ * Pool maximum size.
+ */
+ protected abstract get maxSize (): number
+