Skip to content

Commit 290c533

Browse files
mgmachadonhooyr
authored andcommitted
turn off visibleProgress on ConnectionLost
1 parent 67e2a99 commit 290c533

File tree

1 file changed

+22
-41
lines changed

1 file changed

+22
-41
lines changed

ci/dev/vscode.patch

Lines changed: 22 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -746,53 +746,15 @@ index fdd5890c69f72025b94913380f0d226226e8c8fb..e084236526b38c1144d47b8b3000b367
746746
(err: any, socket: ISocket | undefined) => {
747747
if (err || !socket) {
748748
options.logService.error(`${logPrefix} socketFactory.connect() failed. Error:`);
749-
@@ -411,16 +411,23 @@ abstract class PersistentConnection extends Disposable {
750-
}
751-
const logPrefix = commonLogPrefix(this._connectionType, this.reconnectionToken, true);
749+
@@ -413,6 +413,8 @@ abstract class PersistentConnection extends Disposable {
752750
this._options.logService.info(`${logPrefix} starting reconnecting loop. You can get more information with the trace log level.`);
753-
- this._onDidStateChange.fire(new ConnectionLostEvent());
751+
this._onDidStateChange.fire(new ConnectionLostEvent());
754752
const TIMES = [5, 5, 10, 10, 10, 10, 10, 30];
755-
+ const SHOW_POPUP_ON_ATTEMPT = 2 // aka third attempt
753+
+ // const SHOW_POPUP_ON_ATTEMPT = 2 // aka third attempt
756754
+
757755
const disconnectStartTime = Date.now();
758756
let attempt = -1;
759757
do {
760-
attempt++;
761-
+ if (attempt == SHOW_POPUP_ON_ATTEMPT){
762-
+ this._onDidStateChange.fire(new ConnectionLostEvent());
763-
+ }
764-
+
765-
const waitTime = (attempt < TIMES.length ? TIMES[attempt] : TIMES[TIMES.length - 1]);
766-
try {
767-
const sleepPromise = sleep(waitTime);
768-
- this._onDidStateChange.fire(new ReconnectionWaitEvent(waitTime, sleepPromise));
769-
+ if (attempt >= SHOW_POPUP_ON_ATTEMPT) {
770-
+ this._onDidStateChange.fire(new ReconnectionWaitEvent(waitTime, sleepPromise));
771-
+ }
772-
773-
this._options.logService.info(`${logPrefix} waiting for ${waitTime} seconds before reconnecting...`);
774-
try {
775-
@@ -433,14 +440,17 @@ abstract class PersistentConnection extends Disposable {
776-
}
777-
778-
// connection was lost, let's try to re-establish it
779-
- this._onDidStateChange.fire(new ReconnectionRunningEvent());
780-
+ if (attempt >= SHOW_POPUP_ON_ATTEMPT){
781-
+ this._onDidStateChange.fire(new ReconnectionRunningEvent());
782-
+ }
783-
this._options.logService.info(`${logPrefix} resolving connection...`);
784-
const simpleOptions = await resolveConnectionOptions(this._options, this.reconnectionToken, this.protocol);
785-
this._options.logService.info(`${logPrefix} connecting to ${simpleOptions.host}:${simpleOptions.port}...`);
786-
await connectWithTimeLimit(simpleOptions.logService, this._reconnect(simpleOptions), RECONNECT_TIMEOUT);
787-
this._options.logService.info(`${logPrefix} reconnected!`);
788-
- this._onDidStateChange.fire(new ConnectionGainEvent());
789-
-
790-
+ if (attempt >= SHOW_POPUP_ON_ATTEMPT) {
791-
+ this._onDidStateChange.fire(new ConnectionGainEvent());
792-
+ }
793-
break;
794-
} catch (err) {
795-
if (err.code === 'VSCODE_CONNECTION_ERROR') {
796758
diff --git a/src/vs/platform/storage/browser/storageService.ts b/src/vs/platform/storage/browser/storageService.ts
797759
index ab3fd347b69f8a3d9b96e706cd87c911b8ffed6b..9d351037b577f9f1edfd18ae9b3c48a211f4467f 100644
798760
--- a/src/vs/platform/storage/browser/storageService.ts
@@ -3922,6 +3884,25 @@ index 94e7e7a4bac154c45078a1b5034e50634a7a43af..8164200dcef1efbc65b50eef9c270af3
39223884
this._filenameKey.set(value ? basename(value) : null);
39233885
this._dirnameKey.set(value ? dirname(value).fsPath : null);
39243886
this._pathKey.set(value ? value.fsPath : null);
3887+
diff --git a/src/vs/workbench/contrib/remote/browser/remote.ts b/src/vs/workbench/contrib/remote/browser/remote.ts
3888+
index 98573a206f14928fc3fdf18fe927cb75034e4ad1..2f6a2fd6733e286024d20530773e3fbc26ffe16c 100644
3889+
--- a/src/vs/workbench/contrib/remote/browser/remote.ts
3890+
+++ b/src/vs/workbench/contrib/remote/browser/remote.ts
3891+
@@ -795,10 +795,10 @@ class RemoteAgentConnectionStatusListener implements IWorkbenchContribution {
3892+
}
3893+
switch (e.type) {
3894+
case PersistentConnectionEventType.ConnectionLost:
3895+
- if (!visibleProgress) {
3896+
- visibleProgress = showProgress(ProgressLocation.Dialog, [reconnectButton, reloadButton]);
3897+
- }
3898+
- visibleProgress.report(nls.localize('connectionLost', "Connection Lost"));
3899+
+ // if (!visibleProgress) {
3900+
+ // visibleProgress = showProgress(ProgressLocation.Dialog, [reconnectButton, reloadButton]);
3901+
+ // }
3902+
+ // visibleProgress.report(nls.localize('connectionLost', "Connection Lost"));
3903+
break;
3904+
case PersistentConnectionEventType.ReconnectionWait:
3905+
reconnectWaitEvent = e;
39253906
diff --git a/src/vs/workbench/contrib/scm/browser/media/scm.css b/src/vs/workbench/contrib/scm/browser/media/scm.css
39263907
index 74f6922e98b4bb6a7fb100f5aac015afe9fc171b..3243a97c2d378013d96ffbe87e9df6dd4a66776d 100644
39273908
--- a/src/vs/workbench/contrib/scm/browser/media/scm.css

0 commit comments

Comments
 (0)