@@ -248,17 +248,24 @@ async function createApiWebSocket(accessToken: string): Promise<{ gitpodService:
248
248
} ) ;
249
249
}
250
250
}
251
+ const webSocketMaxRetries = 3 ;
251
252
const webSocket = new ReconnectingWebSocket ( baseURL . replace ( 'https' , 'wss' ) , undefined , {
252
253
minReconnectionDelay : 1000 ,
253
254
connectionTimeout : 10000 ,
254
- maxRetries : 10 ,
255
+ maxRetries : webSocketMaxRetries ,
255
256
debug : false ,
256
257
startClosed : false ,
257
258
WebSocket : GitpodServerWebSocket
258
259
} ) ;
260
+
261
+ let retry = 1 ;
259
262
webSocket . onerror = ( err ) => {
260
- vscode . window . showErrorMessage ( `WebSocket error: ${ err . message } ` ) ;
263
+ vscode . window . showErrorMessage ( `WebSocket error: ${ err . message } (#${ retry } /${ webSocketMaxRetries } )` ) ;
264
+ if ( retry ++ === webSocketMaxRetries ) {
265
+ throw new Error ( 'Maximum websocket connection retries exceeded' ) ;
266
+ }
261
267
} ;
268
+
262
269
doListen ( {
263
270
webSocket,
264
271
logger : new ConsoleLogger ( ) ,
@@ -373,7 +380,7 @@ export function registerAuth(context: vscode.ExtensionContext, logger: (value: s
373
380
context . subscriptions . push ( addCmd ) ;
374
381
375
382
async function createSession ( scopes : readonly string [ ] ) : Promise < vscode . AuthenticationSession > {
376
- const callbackUri = await vscode . env . asExternalUri ( vscode . Uri . parse ( `${ vscode . env . uriScheme } ://gitpod.gitpod-desktop/complete-gitpod-auth` ) ) ;
383
+ const callbackUri = vscode . Uri . parse ( `${ vscode . env . uriScheme } ://gitpod.gitpod-desktop/complete-gitpod-auth` ) ;
377
384
378
385
if ( ! [ ...gitpodScopes ] . every ( ( scope ) => scopes . includes ( scope ) ) ) {
379
386
vscode . window . showErrorMessage ( 'The provided scopes are not enough to turn on Settings Sync' ) ;
0 commit comments