File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed
Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments