type PoolOptions,
type PoolType,
PoolTypes,
- type TasksQueueOptions
+ type TasksQueueOptions,
+ type WorkerType
} from './pool'
import type { IWorker, Task, TasksUsage, WorkerNode } from './worker'
import {
}
}
- /** @inheritDoc */
- public abstract get type (): PoolType
-
/** @inheritDoc */
public get info (): PoolInfo {
return {
type: this.type,
+ worker: this.worker,
minSize: this.minSize,
maxSize: this.maxSize,
workerNodes: this.workerNodes.length,
}
}
+ /**
+ * 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.
*/
await Promise.all(
this.workerNodes.map(async (workerNode, workerNodeKey) => {
this.flushTasksQueue(workerNodeKey)
+ // FIXME: wait for tasks to be finished
await this.destroyWorker(workerNode.worker)
})
)
) {
// Kill message received from the worker: no new tasks are submitted to that worker for a while ( > maxInactiveTime)
this.flushTasksQueue(currentWorkerNodeKey)
+ // FIXME: wait for tasks to be finished
void (this.destroyWorker(workerCreated) as Promise<void>)
}
})