fix: unregister worker callbacks after usage
[poolifier.git] / src / pools / worker.ts
index 5a351df0920244400082391b8d0c0680eb32f7a3..4c877bc8b1dcc58871a55cd70c87871d918c4596 100644 (file)
@@ -144,7 +144,7 @@ export interface WorkerInfo {
   /**
    * Task function names.
    */
-  taskFunctions?: string[]
+  taskFunctionNames?: string[]
 }
 
 /**
@@ -173,6 +173,8 @@ export interface WorkerUsage {
 
 /**
  * Worker choice strategy data.
+ *
+ * @internal
  */
 export interface StrategyData {
   virtualTaskEndTimestamp?: number
@@ -313,4 +315,11 @@ export interface IWorkerNode<Worker extends IWorker, Data = unknown> {
    * @returns The task function worker usage statistics if the task function worker usage statistics are initialized, `undefined` otherwise.
    */
   readonly getTaskFunctionWorkerUsage: (name: string) => WorkerUsage | undefined
+  /**
+   * Deletes task function worker usage statistics.
+   *
+   * @param name - The task function name.
+   * @returns `true` if the task function worker usage statistics were deleted, `false` otherwise.
+   */
+  readonly deleteTaskFunctionWorkerUsage: (name: string) => boolean
 }