fix: handle added function at runtime with dynamic worker
[poolifier.git] / src / pools / pool.ts
index 6156a0421170e6baa8ad7c2071b755da554a03ed..cb7580898656ccd58a379edf24cdc55631301f34 100644 (file)
@@ -251,15 +251,15 @@ export interface IPool<
    */
   readonly addTaskFunction: (
     name: string,
-    taskFunction: TaskFunction
-  ) => boolean
+    taskFunction: TaskFunction<Data, Response>
+  ) => Promise<boolean>
   /**
    * Removes a task function from this pool.
    *
    * @param name - The name of the task function.
    * @returns `true` if the task function was removed, `false` otherwise.
    */
-  readonly removeTaskFunction: (name: string) => boolean
+  readonly removeTaskFunction: (name: string) => Promise<boolean>
   /**
    * Lists the names of task function available in this pool.
    *
@@ -272,7 +272,7 @@ export interface IPool<
    * @param name - The name of the task function.
    * @returns `true` if the default task function was set, `false` otherwise.
    */
-  readonly setDefaultTaskFunction: (name: string) => boolean
+  readonly setDefaultTaskFunction: (name: string) => Promise<boolean>
   /**
    * Sets the worker choice strategy in this pool.
    *