chore: v2.4.4
[poolifier.git] / src / pools / pool.ts
index dbbb5969ebd920022e31d64d156f087065aa9d12..f1da5356a2e5310d799b6e595a898a3aad783600 100644 (file)
@@ -1,4 +1,4 @@
-import EventEmitter from 'events'
+import EventEmitter from 'node:events'
 import type {
   ErrorHandler,
   ExitHandler,
@@ -12,6 +12,19 @@ import type { WorkerChoiceStrategy } from './selection-strategies/selection-stra
  */
 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.
  */
@@ -56,7 +69,8 @@ export interface IPool<Data = unknown, Response = unknown> {
    *
    * 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
   /**