Skip to content

Commit

Permalink
fix: when retries is set to zero, throw the error
Browse files Browse the repository at this point in the history
  • Loading branch information
bgiori committed Dec 20, 2024
1 parent fcc3723 commit 3bcb5a1
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions packages/node/src/remote/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export class RemoteEvaluationClient {
console.error('[Experiment] Fetch failed: ', e);
if (this.shouldRetryFetch(e)) {
try {
return await this.retryFetch(user, options);
return await this.retryFetch(user, options, e);
} catch (e) {
console.error(e);
}
Expand Down Expand Up @@ -117,13 +117,10 @@ export class RemoteEvaluationClient {

private async retryFetch(
user: ExperimentUser,
options?: FetchOptions,
options: FetchOptions,
err: Error,
): Promise<Record<string, Variant>> {
if (this.config.fetchRetries == 0) {
return {};
}
this.debug('[Experiment] Retrying fetch');
let err: Error = null;
let delayMillis = this.config.fetchRetryBackoffMinMillis;
for (let i = 0; i < this.config.fetchRetries; i++) {
await sleep(delayMillis);
Expand Down

0 comments on commit 3bcb5a1

Please sign in to comment.