+import type EventEmitterAsyncResource from 'node:events';
import type { Worker } from 'node:worker_threads';
-import { DynamicThreadPool, type ErrorHandler, type ExitHandler } from 'poolifier';
+import { DynamicThreadPool, type ErrorHandler, type ExitHandler, type PoolInfo } from 'poolifier';
import { WorkerAbstract } from './WorkerAbstract';
import type { WorkerData, WorkerOptions } from './WorkerTypes';
);
}
+ get info(): PoolInfo {
+ return this.pool.info;
+ }
+
get size(): number {
- return this.pool.workerNodes.length;
+ return this.pool.info.workerNodes;
}
get maxElementsPerWorker(): number | undefined {
return undefined;
}
- /**
- *
- * @returns
- * @public
- */
+ get emitter(): EventEmitterAsyncResource | undefined {
+ return this.pool?.emitter;
+ }
+
+ /** @inheritDoc */
public async start(): Promise<void> {
// This is intentional
}
- /**
- *
- * @returns
- * @public
- */
+ /** @inheritDoc */
public async stop(): Promise<void> {
return this.pool.destroy();
}
- /**
- *
- * @param elementData -
- * @returns
- * @public
- */
+ /** @inheritDoc */
public async addElement(elementData: WorkerData): Promise<void> {
await this.pool.execute(elementData);
// Start element sequentially to optimize memory at startup