X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fpools%2Fselection-strategies%2Fabstract-worker-choice-strategy.ts;h=c364933358528ef3ade54a3cc3dd474cf2c2d9d3;hb=8d0e8c50707b1c0045c6d2072a4deb18dd857a68;hp=75c7450d8ccc5f8b73d74b5404f4410f4376a46e;hpb=ae3ab61d14adc1f0511e8dea1f69a1d44e7effdf;p=poolifier.git diff --git a/src/pools/selection-strategies/abstract-worker-choice-strategy.ts b/src/pools/selection-strategies/abstract-worker-choice-strategy.ts index 75c7450d..c3649333 100644 --- a/src/pools/selection-strategies/abstract-worker-choice-strategy.ts +++ b/src/pools/selection-strategies/abstract-worker-choice-strategy.ts @@ -123,17 +123,16 @@ export abstract class AbstractWorkerChoiceStrategy< * @returns Whether the worker node is ready or not. */ protected isWorkerNodeReady (workerNodeKey: number): boolean { - return this.pool.workerNodes[workerNodeKey]?.info.ready ?? false + return this.pool.workerNodes[workerNodeKey]?.info?.ready ?? false } /** - * 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. + * Check the next worker node readiness. */ - protected hasWorkerNodeBackPressure (workerNodeKey: number): boolean { - return this.pool.hasWorkerNodeBackPressure(workerNodeKey) + protected checkNextWorkerNodeReadiness (): void { + if (!this.isWorkerNodeReady(this.nextWorkerNodeKey as number)) { + delete this.nextWorkerNodeKey + } } /**