From 6710e1acdfac6f43503f829ec6eb2a05f8b1ae41 Mon Sep 17 00:00:00 2001 From: Kaushal Kapasi <91074031+kaushalkapasi@users.noreply.github.com> Date: Tue, 20 Aug 2024 12:51:36 -0400 Subject: [PATCH] fix: reset current promise after every config request (#939) --- sdk/js/src/ConfigRequestConsolidator.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/sdk/js/src/ConfigRequestConsolidator.ts b/sdk/js/src/ConfigRequestConsolidator.ts index 12604cc31..69dddf2f3 100644 --- a/sdk/js/src/ConfigRequestConsolidator.ts +++ b/sdk/js/src/ConfigRequestConsolidator.ts @@ -89,8 +89,12 @@ export class ConfigRequestConsolidator { this.requestParams ? this.requestParams : undefined, ) this.requestParams = null - const bucketedConfig = await this.currentPromise - this.currentPromise = null + const bucketedConfig = await this.currentPromise.finally(() => { + // clear the current promise so we can make another request + // this should happen regardless of whether the request was successful or not + this.currentPromise = null + }) + return bucketedConfig } }