Skip to content

Commit 390e7cc

Browse files
Update src/exportAuthRecord.ts
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 00dd012 commit 390e7cc

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/exportAuthRecord.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,19 @@ export class AuthAccountStateManager {
4949

5050
// If we're currently updating, create a promise that waits for the update to finish
5151
if (this.isUpdating) {
52-
const waitPromise = new Promise<readonly vscode.AuthenticationSessionAccountInformation[]>((resolve) => {
52+
const waitPromise = new Promise<readonly vscode.AuthenticationSessionAccountInformation[]>((resolve, reject) => {
53+
const timeoutMs = 5000; // 5 seconds timeout
5354
const checkInterval = setInterval(() => {
5455
if (!this.isUpdating) {
5556
clearInterval(checkInterval);
57+
clearTimeout(timeoutHandle);
5658
resolve(this.accountsCache);
5759
}
5860
}, 10);
61+
const timeoutHandle = setTimeout(() => {
62+
clearInterval(checkInterval);
63+
reject(new Error('Timed out waiting for account update to finish.'));
64+
}, timeoutMs);
5965
});
6066
const accounts = await waitPromise;
6167
return { accounts, hasNewAccounts: false, accountsRemoved: false }; // Already processed

0 commit comments

Comments
 (0)