From 3bcb5a17eae9af74481130b14fe19daf3c65c0ed Mon Sep 17 00:00:00 2001 From: Brian Giori Date: Thu, 19 Dec 2024 16:59:31 -0800 Subject: [PATCH] fix: when retries is set to zero, throw the error --- packages/node/src/remote/client.ts | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/packages/node/src/remote/client.ts b/packages/node/src/remote/client.ts index f0b601b..670a3c8 100644 --- a/packages/node/src/remote/client.ts +++ b/packages/node/src/remote/client.ts @@ -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); } @@ -117,13 +117,10 @@ export class RemoteEvaluationClient { private async retryFetch( user: ExperimentUser, - options?: FetchOptions, + options: FetchOptions, + err: Error, ): Promise> { - 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);