perf: remove unneeded class indirection for dynamic pool in worker
[poolifier.git] / src / pools / selection-strategies / selection-strategies-types.ts
index a05fd9b784c9da682cd0e270f09b81ce41325d70..ed6b010397b57e7980c916452c526ab7bb546e66 100644 (file)
@@ -30,10 +30,11 @@ export const WorkerChoiceStrategies = Object.freeze({
 export type WorkerChoiceStrategy = keyof typeof WorkerChoiceStrategies
 
 /**
- * Pool tasks usage statistics requirements.
+ * Pool worker tasks usage statistics requirements.
  */
 export interface RequiredStatistics {
   runTime: boolean
+  avgRunTime: boolean
 }
 
 /**
@@ -56,4 +57,10 @@ export interface IWorkerChoiceStrategy {
    * Chooses a worker in the pool and returns its key.
    */
   choose: () => number
+  /**
+   * Removes a worker reference from strategy internals.
+   *
+   * @param workerKey - The worker key.
+   */
+  remove: (workerKey: number) => boolean
 }