X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fpools%2Fselection-strategies%2Fworker-choice-strategy-context.ts;h=7c7574fa7a39f55913282a60bd0becf35e88b6fc;hb=12668d727d1e1ed4e41479d9001b32180369e1de;hp=8c5a9587debbd4b66fba9a7630838fcc44cabc3c;hpb=8990357d855c45cd0063f24092bb58b4163ddb0a;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 8c5a9587..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,8 +183,11 @@ export class WorkerChoiceStrategyContext< this.choiceRetriesCount++ return this.execute() } else if (workerNodeKey == null) { - throw new TypeError('Worker node key chosen is null or undefined') + throw new Error( + `Worker node key chosen is null or undefined after ${this.choiceRetriesCount} retries` + ) } + this.choiceRetriesCount = 0 return workerNodeKey }