refactor: cleanup worker node back pressure API
[poolifier.git] / src / pools / selection-strategies / abstract-worker-choice-strategy.ts
index 9c20c5bea63143f3b3e556f2629b635026e32a2a..d4fcd8d0a95bae029d23ef386fd7cbd2d17a7dde 100644 (file)
@@ -114,6 +114,16 @@ export abstract class AbstractWorkerChoiceStrategy<
     return this.pool.workerNodes[workerNodeKey].info.ready
   }
 
+  /**
+   * Whether the worker node has back pressure or not (i.e. its tasks queue is full).
+   *
+   * @param workerNodeKey - The worker node key.
+   * @returns `true` if the worker node has back pressure, `false` otherwise.
+   */
+  protected hasWorkerNodeBackPressure (workerNodeKey: number): boolean {
+    return this.pool.hasWorkerNodeBackPressure(workerNodeKey)
+  }
+
   /**
    * Gets the worker task runtime.
    * If the task statistics require the average runtime, the average runtime is returned.