Skip to content

Commit 6ea6f2b

Browse files
authored
fix(token-manager): reset requestTime on token acquisition failure (#316)
Reset `requestTime` and clear `pendingRequests` in the error handler to prevent a 60-second authentication freeze after failed token acquisition attempts. Previously, `requestTime` remained set after failures, causing subsequent requests to queue indefinitely. Signed-off-by: Norbert Biczo <pyrooka@users.noreply.github.com>
1 parent 935d744 commit 6ea6f2b

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

auth/token-managers/token-manager.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,9 @@ export class TokenManager {
189189
this.pendingRequests.forEach(({ reject }) => {
190190
reject(err);
191191
});
192+
// Reset the queue and the request time if the token acquisition fails.
193+
this.pendingRequests = [];
194+
this.requestTime = 0;
192195
throw err;
193196
});
194197
}

0 commit comments

Comments
 (0)