You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: packages/jupyterlab-lsp/src/connection_manager.ts
+29-4Lines changed: 29 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -283,18 +283,43 @@ export class DocumentConnectionManager {
283
283
}
284
284
}
285
285
286
-
asyncconnect(options: ISocketConnectionOptions){
286
+
asyncconnect(
287
+
options: ISocketConnectionOptions,
288
+
firstTimeoutSeconds=30,
289
+
secondTimeoutMinutes=5
290
+
){
287
291
this.console.log('connection requested',options);
288
292
letconnection=awaitthis.connect_socket(options);
289
293
290
294
let{ virtual_document, document_path }=options;
291
295
292
296
if(!connection.isReady){
293
297
try{
294
-
awaituntil_ready(()=>connection.isReady,200,200);
298
+
// user feedback hinted that 40 seconds was too short and some users are willing to wait more;
299
+
// to make the best of both worlds we first check frequently (6.6 times a second) for the first
300
+
// 30 seconds, and show the warning early in case if something is wrong; we then continue retrying
301
+
// for another 5 minutes, but only once per second.
302
+
awaituntil_ready(
303
+
()=>connection.isReady,
304
+
Math.round((firstTimeoutSeconds*1000)/150),
305
+
150
306
+
);
295
307
}catch{
296
-
this.console.warn(`Connect timed out for ${virtual_document.uri}`);
297
-
return;
308
+
this.console.warn(
309
+
`LSP: Connection to ${virtual_document.uri} timed out after ${firstTimeoutSeconds} seconds, will continue retrying for another ${secondTimeoutMinutes} minutes`
310
+
);
311
+
try{
312
+
awaituntil_ready(
313
+
()=>connection.isReady,
314
+
60*secondTimeoutMinutes,
315
+
1000
316
+
);
317
+
}catch{
318
+
this.console.warn(
319
+
`LSP: Connection to ${virtual_document.uri} timed out again after ${secondTimeoutMinutes} minutes, giving up`
0 commit comments