Skip to content

Commit 4196b55

Browse files
committed
💄
1 parent 0e36011 commit 4196b55

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

src/remoteConnector.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -693,15 +693,15 @@ export class RemoteConnector extends Disposable {
693693
await this.updateRemoteSSHConfig(true, undefined);
694694

695695
this.localSSHService.flow = sshFlow;
696-
const [_, isExtensionServerReady] = await Promise.all([
696+
const [isSupportLocalSSH, isExtensionServerReady] = await Promise.all([
697697
this.localSSHService.initialize(),
698698
this.localSSHService.extensionServerReady()
699699
]);
700700
if (!isExtensionServerReady) {
701701
this.logService.error('Extension IPC server is not ready');
702702
useLocalSSH = false;
703703
}
704-
if (!this.localSSHService.isSupportLocalSSH) {
704+
if (!isSupportLocalSSH) {
705705
this.logService.error('Local SSH is not supported on this platform');
706706
useLocalSSH = false;
707707
}

src/services/localSSHService.ts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,8 @@ import { canExtensionServiceServerWork } from '../local-ssh/ipc/extensionService
2020

2121
export interface ILocalSSHService {
2222
flow?: UserFlowTelemetryProperties;
23-
isSupportLocalSSH: boolean;
2423

25-
initialize: () => Promise<void>;
24+
initialize: () => Promise<boolean>;
2625
extensionServerReady: () => Promise<boolean>;
2726
}
2827

@@ -32,9 +31,8 @@ type FailedToInitializeCode = 'Unknown' | 'LockFailed' | string;
3231
const IgnoredFailedCodes: FailedToInitializeCode[] = ['ENOSPC'];
3332

3433
export class LocalSSHService extends Disposable implements ILocalSSHService {
35-
private initPromise!: Promise<void>;
34+
private initPromise!: Promise<boolean>;
3635

37-
public isSupportLocalSSH: boolean = false;
3836
public flow?: UserFlowTelemetryProperties;
3937

4038
constructor(
@@ -47,7 +45,7 @@ export class LocalSSHService extends Disposable implements ILocalSSHService {
4745
super();
4846
}
4947

50-
async initialize(): Promise<void> {
48+
async initialize(): Promise<boolean> {
5149
if (this.initPromise) {
5250
return this.initPromise;
5351
}
@@ -99,20 +97,23 @@ export class LocalSSHService extends Disposable implements ILocalSSHService {
9997
}
10098
}
10199

102-
private async doInitialize() {
103-
let failureCode: FailedToInitializeCode | undefined;
100+
private async doInitialize(): Promise<boolean> {
101+
let flowData = this.flow ?? { gitpodHost: this.hostService.gitpodHost, userId: this.sessionService.safeGetUserId() };
102+
flowData = { ...flowData, flow: 'local_ssh_config', useLocalAPP: String(Configuration.getUseLocalApp()) };
104103
try {
105104
const lockFolder = vscode.Uri.joinPath(this.context.globalStorageUri, 'initialize');
106105
await this.lock(lockFolder.fsPath, async () => {
107106
const locations = await this.copyProxyScript();
108107
await this.configureSettings(locations);
109-
this.isSupportLocalSSH = true;
110108
});
109+
110+
this.telemetryService.sendUserFlowStatus('success', flowData);
111+
return true;
111112
} catch (e) {
112113
this.logService.error('Failed to initialize ssh proxy config', e);
113114

114115
let sendErrorReport = true;
115-
failureCode = 'Unknown';
116+
let failureCode: FailedToInitializeCode = 'Unknown';
116117
if (e?.code) {
117118
failureCode = e.code;
118119
sendErrorReport = !IgnoredFailedCodes.includes(e.code);
@@ -123,11 +124,10 @@ export class LocalSSHService extends Disposable implements ILocalSSHService {
123124
if (sendErrorReport) {
124125
this.telemetryService.sendTelemetryException(e, { gitpodHost: this.hostService.gitpodHost, useLocalAPP: String(Configuration.getUseLocalApp()) });
125126
}
126-
this.isSupportLocalSSH = false;
127-
}
128127

129-
const flowData = this.flow ?? { gitpodHost: this.hostService.gitpodHost, userId: this.sessionService.safeGetUserId() };
130-
this.telemetryService.sendUserFlowStatus(this.isSupportLocalSSH ? 'success' : 'failure', { ...flowData, flow: 'local_ssh_config', failureCode, useLocalAPP: String(Configuration.getUseLocalApp()) });
128+
this.telemetryService.sendUserFlowStatus('failure', { ...flowData, failureCode });
129+
return false;
130+
}
131131
}
132132

133133
private async configureSettings({ proxyScript, launcher }: { proxyScript: string; launcher: string }) {

0 commit comments

Comments
 (0)