build(deps-dev): apply updates
[poolifier.git] / src / pools / selection-strategies / selection-strategies-types.ts
index 9f68c22f892c50a3e424b59a3cb0cffe9f61557f..58f36328f98e78dacc1f87fb42914e008f5b7f67 100644 (file)
@@ -70,7 +70,13 @@ export interface MeasurementOptions {
  */
 export interface WorkerChoiceStrategyOptions {
   /**
-   * Measurement to use for worker choice strategy.
+   * Number of worker choice retries to perform if no worker is eligible.
+   *
+   * @defaultValue 6
+   */
+  readonly choiceRetries?: number
+  /**
+   * Measurement to use in worker choice strategy supporting it.
    */
   readonly measurement?: Measurement
   /**
@@ -147,13 +153,15 @@ export interface TaskStatisticsRequirements {
  */
 export interface StrategyPolicy {
   /**
-   * Expects direct usage of dynamic worker.
+   * Expects direct usage of the newly created dynamic worker.
    */
   readonly useDynamicWorker: boolean
 }
 
 /**
  * Worker choice strategy interface.
+ *
+ * @internal
  */
 export interface IWorkerChoiceStrategy {
   /**
@@ -169,30 +177,30 @@ export interface IWorkerChoiceStrategy {
    *
    * @returns `true` if the reset is successful, `false` otherwise.
    */
-  reset: () => boolean
+  readonly reset: () => boolean
   /**
    * Updates the worker node key strategy internals.
    *
    * @returns `true` if the update is successful, `false` otherwise.
    */
-  update: (workerNodeKey: number) => boolean
+  readonly update: (workerNodeKey: number) => boolean
   /**
    * Chooses a worker node in the pool and returns its key.
    *
    * @returns The worker node key.
    */
-  choose: () => number
+  readonly choose: () => number
   /**
    * Removes the worker node key from strategy internals.
    *
    * @param workerNodeKey - The worker node key.
    * @returns `true` if the worker node key is removed, `false` otherwise.
    */
-  remove: (workerNodeKey: number) => boolean
+  readonly remove: (workerNodeKey: number) => boolean
   /**
    * Sets the worker choice strategy options.
    *
    * @param opts - The worker choice strategy options.
    */
-  setOptions: (opts: WorkerChoiceStrategyOptions) => void
+  readonly setOptions: (opts: WorkerChoiceStrategyOptions) => void
 }