From 53c5030109d402201b7a4b0db260e818f580fd24 Mon Sep 17 00:00:00 2001 From: Michael Grosse Huelsewiesche Date: Mon, 11 Sep 2023 10:32:13 -0400 Subject: [PATCH] Preventing redundant token fetches --- packages/node/src/lib/oauth-util.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/node/src/lib/oauth-util.ts b/packages/node/src/lib/oauth-util.ts index 89bb9a358..1ea456a6e 100644 --- a/packages/node/src/lib/oauth-util.ts +++ b/packages/node/src/lib/oauth-util.ts @@ -27,7 +27,9 @@ export interface OauthData { export const RefreshToken = (data: OauthData) => { clearTimeout(data.refreshTimer) data.refreshTimer = undefined - data.refreshPromise = RefreshTokenAsync(data) + if (!data.refreshPromise) { + data.refreshPromise = RefreshTokenAsync(data) + } } export const RefreshTokenAsync = async (data: OauthData) => {