ExitHandler,
MessageHandler,
OnlineHandler
-} from './pool-worker'
-import type { WorkerChoiceStrategy } from './selection-strategies/selection-strategies-types'
+} from './worker'
+import type {
+ WorkerChoiceStrategy,
+ WorkerChoiceStrategyOptions
+} from './selection-strategies/selection-strategies-types'
/**
* Pool events emitter.
*/
export class PoolEmitter extends EventEmitter {}
+/**
+ * Enumeration of pool events.
+ */
+export const PoolEvents = Object.freeze({
+ full: 'full',
+ busy: 'busy'
+} as const)
+
+/**
+ * Pool event.
+ */
+export type PoolEvent = keyof typeof PoolEvents
+
/**
* Options for a poolifier pool.
*/
* The worker choice strategy to use in this pool.
*/
workerChoiceStrategy?: WorkerChoiceStrategy
+ /**
+ * The worker choice strategy options.
+ */
+ workerChoiceStrategyOptions?: WorkerChoiceStrategyOptions
/**
* Pool events emission.
*
* @defaultValue true
*/
enableEvents?: boolean
+ /**
+ * Pool worker tasks queue.
+ *
+ * @experimental
+ * @defaultValue false
+ */
+ enableTasksQueue?: boolean
}
/**
*
* Events that can currently be listened to:
*
- * - `'busy'`
+ * - `'full'`: Emitted when the pool is dynamic and full.
+ * - `'busy'`: Emitted when the pool is busy.
*/
readonly emitter?: PoolEmitter
/**