fix: fix worker choice strategy retries mechanism on some edge cases
[poolifier.git] / src / pools / selection-strategies / selection-strategies-types.ts
index 58f36328f98e78dacc1f87fb42914e008f5b7f67..4377624e97a1d316dba60687870ac6308d44b158 100644 (file)
@@ -153,9 +153,13 @@ export interface TaskStatisticsRequirements {
  */
 export interface StrategyPolicy {
   /**
-   * Expects direct usage of the newly created dynamic worker.
+   * Expects tasks execution on the newly created dynamic worker.
    */
-  readonly useDynamicWorker: boolean
+  readonly dynamicWorkerUsage: boolean
+  /**
+   * Expects the newly created dynamic worker to be flagged as ready.
+   */
+  readonly dynamicWorkerReady: boolean
 }
 
 /**
@@ -186,10 +190,11 @@ export interface IWorkerChoiceStrategy {
   readonly update: (workerNodeKey: number) => boolean
   /**
    * Chooses a worker node in the pool and returns its key.
+   * If the worker node is not eligible, `undefined` is returned.
    *
-   * @returns The worker node key.
+   * @returns The worker node key or `undefined`.
    */
-  readonly choose: () => number
+  readonly choose: () => number | undefined
   /**
    * Removes the worker node key from strategy internals.
    *