X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fpools%2Fselection-strategies%2Fworker-choice-strategy-context.ts;h=7c7574fa7a39f55913282a60bd0becf35e88b6fc;hb=e67d73d5f630e0882cfb4ab90dc889ad4812c176;hp=fefc1275f5cb7fbacf72d689dfaf8140a733ffac;hpb=4ba8492f17b13668853cfc15a1ec9ff8c8d7b179;p=poolifier.git diff --git a/src/pools/selection-strategies/worker-choice-strategy-context.ts b/src/pools/selection-strategies/worker-choice-strategy-context.ts index fefc1275..7c7574fa 100644 --- a/src/pools/selection-strategies/worker-choice-strategy-context.ts +++ b/src/pools/selection-strategies/worker-choice-strategy-context.ts @@ -168,7 +168,7 @@ export class WorkerChoiceStrategyContext< * Executes the worker choice strategy in the context algorithm. * * @returns The key of the worker node. - * @throws {@link https://nodejs.org/api/errors.html#class-error} If the worker node key is null or undefined. + * @throws {@link https://nodejs.org/api/errors.html#class-error} If after configured retries the worker node key is null or undefined . */ public execute (): number { const workerNodeKey = ( @@ -183,10 +183,11 @@ export class WorkerChoiceStrategyContext< this.choiceRetriesCount++ return this.execute() } else if (workerNodeKey == null) { - throw new TypeError( + throw new Error( `Worker node key chosen is null or undefined after ${this.choiceRetriesCount} retries` ) } + this.choiceRetriesCount = 0 return workerNodeKey }