diff --git a/keyserver/src/push/providers.js b/keyserver/src/push/providers.js --- a/keyserver/src/push/providers.js +++ b/keyserver/src/push/providers.js @@ -154,11 +154,12 @@ let wnsAccessToken: ?WNSAccessToken = null; async function getWNSToken(): Promise { const expiryWindowInMs = 10_000; + const localWNSAccessToken = wnsAccessToken; if ( - wnsAccessToken && - wnsAccessToken.expires >= Date.now() - expiryWindowInMs + localWNSAccessToken && + localWNSAccessToken.expires >= Date.now() - expiryWindowInMs ) { - return wnsAccessToken.token; + return localWNSAccessToken.token; } const config = await getCommConfig({