Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
gzupanda
code-server
提交
e5067ba2
C
code-server
项目概览
gzupanda
/
code-server
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
C
code-server
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
e5067ba2
编写于
11月 17, 2020
作者:
M
Machado, Meygha
提交者:
Anmol Sethi
11月 30, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
separate event domain from UI
上级
fa0853dc
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
38 addition
and
25 deletion
+38
-25
ci/dev/vscode.patch
ci/dev/vscode.patch
+38
-25
未找到文件。
ci/dev/vscode.patch
浏览文件 @
e5067ba2
...
...
@@ -746,12 +746,12 @@ index fdd5890c69f72025b94913380f0d226226e8c8fb..e084236526b38c1144d47b8b3000b367
(err: any, socket: ISocket | undefined) => {
if (err || !socket) {
options.logService.error(`${logPrefix} socketFactory.connect() failed. Error:`);
@@ -331,12 +331,1
7
@@
export const enum PersistentConnectionEventType {
@@ -331,12 +331,1
6
@@
export const enum PersistentConnectionEventType {
}
export class ConnectionLostEvent {
public readonly type = PersistentConnectionEventType.ConnectionLost;
+ constructor(
+ public readonly
suppressPopup?: boolean
+ public readonly
connectionAttempt?: number
+ ) { }
}
export class ReconnectionWaitEvent {
...
...
@@ -760,67 +760,68 @@ index fdd5890c69f72025b94913380f0d226226e8c8fb..e084236526b38c1144d47b8b3000b367
public readonly durationSeconds: number,
- private readonly cancellableTimer: CancelablePromise<void>
+ private readonly cancellableTimer: CancelablePromise<void>,
+ public readonly suppressPopup?: boolean,
+ public readonly forceDialog?: boolean
+ public readonly connectionAttempt?: number,
) { }
public skipWait(): void {
@@ -345,12 +3
50
,21 @@
export class ReconnectionWaitEvent {
@@ -345,12 +3
49
,21 @@
export class ReconnectionWaitEvent {
}
export class ReconnectionRunningEvent {
public readonly type = PersistentConnectionEventType.ReconnectionRunning;
+ constructor(
+ public readonly
suppressPopup?: boolean
+ public readonly
connectionAttempt?: number
+ ) { }
}
export class ConnectionGainEvent {
public readonly type = PersistentConnectionEventType.ConnectionGain;
+ constructor(
+ public readonly
suppressPopup?: boolean
+ public readonly
connectionAttempt?: number
+ ) { }
}
export class ReconnectionPermanentFailureEvent {
public readonly type = PersistentConnectionEventType.ReconnectionPermanentFailure;
+ constructor(
+ public readonly
suppressPopup?: boolean | undefined
+ public readonly
connectionAttempt?: number
+ ) { }
}
export type PersistenConnectionEvent = ConnectionGainEvent | ConnectionLostEvent | ReconnectionWaitEvent | ReconnectionRunningEvent | ReconnectionPermanentFailureEvent;
@@ -411,
16 +425,22
@@
abstract class PersistentConnection extends Disposable {
@@ -411,
8 +424,9
@@
abstract class PersistentConnection extends Disposable {
}
const logPrefix = commonLogPrefix(this._connectionType, this.reconnectionToken, true);
this._options.logService.info(`${logPrefix} starting reconnecting loop. You can get more information with the trace log level.`);
- this._onDidStateChange.fire(new ConnectionLostEvent());
+ let suppressPopup = true;
+ let forceDialog = false;
+ this._onDidStateChange.fire(new ConnectionLostEvent(suppressPopup));
+ this._onDidStateChange.fire(new ConnectionLostEvent(0));
const TIMES = [5, 5, 10, 10, 10, 10, 10, 30];
+ const SHOW_POPUP_ON_ATTEMPT = 2 // aka third attempt
+
const disconnectStartTime = Date.now();
let attempt = -1;
do {
attempt++;
+ suppressPopup = (attempt < SHOW_POPUP_ON_ATTEMPT) ? true : false
+ forceDialog = (attempt == SHOW_POPUP_ON_ATTEMPT)
@@ -420,7 +434,7 @@
abstract class PersistentConnection extends Disposable {
const waitTime = (attempt < TIMES.length ? TIMES[attempt] : TIMES[TIMES.length - 1]);
try {
const sleepPromise = sleep(waitTime);
- this._onDidStateChange.fire(new ReconnectionWaitEvent(waitTime, sleepPromise));
+ this._onDidStateChange.fire(new ReconnectionWaitEvent(waitTime, sleepPromise,
suppressPopup, forceDialog
));
+ this._onDidStateChange.fire(new ReconnectionWaitEvent(waitTime, sleepPromise,
attempt
));
this._options.logService.info(`${logPrefix} waiting for ${waitTime} seconds before reconnecting...`);
try {
@@ -433,
7 +453,7
@@
abstract class PersistentConnection extends Disposable {
@@ -433,
13 +447,13
@@
abstract class PersistentConnection extends Disposable {
}
// connection was lost, let's try to re-establish it
- this._onDidStateChange.fire(new ReconnectionRunningEvent());
+ this._onDidStateChange.fire(new ReconnectionRunningEvent(
suppressPopup
));
+ this._onDidStateChange.fire(new ReconnectionRunningEvent(
attempt
));
this._options.logService.info(`${logPrefix} resolving connection...`);
const simpleOptions = await resolveConnectionOptions(this._options, this.reconnectionToken, this.protocol);
this._options.logService.info(`${logPrefix} connecting to ${simpleOptions.host}:${simpleOptions.port}...`);
await connectWithTimeLimit(simpleOptions.logService, this._reconnect(simpleOptions), RECONNECT_TIMEOUT);
this._options.logService.info(`${logPrefix} reconnected!`);
- this._onDidStateChange.fire(new ConnectionGainEvent());
+ this._onDidStateChange.fire(new ConnectionGainEvent(attempt));
break;
} catch (err) {
diff --git a/src/vs/platform/storage/browser/storageService.ts b/src/vs/platform/storage/browser/storageService.ts
index ab3fd347b69f8a3d9b96e706cd87c911b8ffed6b..9d351037b577f9f1edfd18ae9b3c48a211f4467f 100644
--- a/src/vs/platform/storage/browser/storageService.ts
...
...
@@ -3951,16 +3952,28 @@ index 94e7e7a4bac154c45078a1b5034e50634a7a43af..8164200dcef1efbc65b50eef9c270af3
this._dirnameKey.set(value ? dirname(value).fsPath : null);
this._pathKey.set(value ? value.fsPath : null);
diff --git a/src/vs/workbench/contrib/remote/browser/remote.ts b/src/vs/workbench/contrib/remote/browser/remote.ts
index 98573a206f14928fc3fdf18fe927cb75034e4ad1..
a031f76924abf8f10c510ea9c043f670c5b43074
100644
index 98573a206f14928fc3fdf18fe927cb75034e4ad1..
1430666aa94f941bda086df503fec8b35aa2b25f
100644
--- a/src/vs/workbench/contrib/remote/browser/remote.ts
+++ b/src/vs/workbench/contrib/remote/browser/remote.ts
@@ -795,31 +795,43 @@
class RemoteAgentConnectionStatusListener implements IWorkbenchContribution {
@@ -730,6 +730,7 @@
class RemoteAgentConnectionStatusListener implements IWorkbenchContribution {
@IContextKeyService contextKeyService: IContextKeyService
) {
const connection = remoteAgentService.getConnection();
+ const SHOW_POPUP_ON_ATTEMPT = 2 // aka third attempt
if (connection) {
let visibleProgress: VisibleProgress | null = null;
let lastLocation: ProgressLocation.Dialog | ProgressLocation.Notification | null = null;
@@ -793,33 +794,47 @@
class RemoteAgentConnectionStatusListener implements IWorkbenchContribution {
disposableListener.dispose();
disposableListener = null;
}
+ let suppressPopup = (typeof e.connectionAttempt == 'number' && e.connectionAttempt < SHOW_POPUP_ON_ATTEMPT)
+ let forceDialog = (typeof e.connectionAttempt == 'number' && e.connectionAttempt == SHOW_POPUP_ON_ATTEMPT)
switch (e.type) {
case PersistentConnectionEventType.ConnectionLost:
- if (!visibleProgress) {
- visibleProgress = showProgress(ProgressLocation.Dialog, [reconnectButton, reloadButton]);
+ if (
e.
suppressPopup) {
+ if (suppressPopup) {
+ hideProgress()
+ } else {
+ if (!visibleProgress) {
...
...
@@ -3974,10 +3987,10 @@ index 98573a206f14928fc3fdf18fe927cb75034e4ad1..a031f76924abf8f10c510ea9c043f670
reconnectWaitEvent = e;
- visibleProgress = showProgress(lastLocation || ProgressLocation.Notification, [reconnectButton, reloadButton]);
- visibleProgress.startTimer(Date.now() + 1000 * e.durationSeconds);
+ if (
e.
suppressPopup) {
+ if (suppressPopup) {
+ hideProgress()
+ } else {
+ const location =
e.
forceDialog ? ProgressLocation.Dialog : (lastLocation || ProgressLocation.Notification)
+ const location = forceDialog ? ProgressLocation.Dialog : (lastLocation || ProgressLocation.Notification)
+ visibleProgress = showProgress(location, [reconnectButton, reloadButton]);
+ visibleProgress.startTimer(Date.now() + 1000 * e.durationSeconds);
+ }
...
...
@@ -3993,7 +4006,7 @@ index 98573a206f14928fc3fdf18fe927cb75034e4ad1..a031f76924abf8f10c510ea9c043f670
- // Need to move from dialog if being shown and user needs to type in a prompt
- if (lastLocation === ProgressLocation.Dialog && visibleProgress !== null) {
- visibleProgress = showProgress(ProgressLocation.Notification, [reloadButton], visibleProgress.lastReport);
+ if (
e.
suppressPopup) {
+ if (suppressPopup) {
+ hideProgress()
+ } else {
+ visibleProgress = showProgress(lastLocation || ProgressLocation.Notification, [reloadButton]);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录