@@ -20,9 +20,8 @@ import { canExtensionServiceServerWork } from '../local-ssh/ipc/extensionService
20
20
21
21
export interface ILocalSSHService {
22
22
flow ?: UserFlowTelemetryProperties ;
23
- isSupportLocalSSH : boolean ;
24
23
25
- initialize : ( ) => Promise < void > ;
24
+ initialize : ( ) => Promise < boolean > ;
26
25
extensionServerReady : ( ) => Promise < boolean > ;
27
26
}
28
27
@@ -32,9 +31,8 @@ type FailedToInitializeCode = 'Unknown' | 'LockFailed' | string;
32
31
const IgnoredFailedCodes : FailedToInitializeCode [ ] = [ 'ENOSPC' ] ;
33
32
34
33
export class LocalSSHService extends Disposable implements ILocalSSHService {
35
- private initPromise ! : Promise < void > ;
34
+ private initPromise ! : Promise < boolean > ;
36
35
37
- public isSupportLocalSSH : boolean = false ;
38
36
public flow ?: UserFlowTelemetryProperties ;
39
37
40
38
constructor (
@@ -47,7 +45,7 @@ export class LocalSSHService extends Disposable implements ILocalSSHService {
47
45
super ( ) ;
48
46
}
49
47
50
- async initialize ( ) : Promise < void > {
48
+ async initialize ( ) : Promise < boolean > {
51
49
if ( this . initPromise ) {
52
50
return this . initPromise ;
53
51
}
@@ -99,20 +97,23 @@ export class LocalSSHService extends Disposable implements ILocalSSHService {
99
97
}
100
98
}
101
99
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 ( ) ) } ;
104
103
try {
105
104
const lockFolder = vscode . Uri . joinPath ( this . context . globalStorageUri , 'initialize' ) ;
106
105
await this . lock ( lockFolder . fsPath , async ( ) => {
107
106
const locations = await this . copyProxyScript ( ) ;
108
107
await this . configureSettings ( locations ) ;
109
- this . isSupportLocalSSH = true ;
110
108
} ) ;
109
+
110
+ this . telemetryService . sendUserFlowStatus ( 'success' , flowData ) ;
111
+ return true ;
111
112
} catch ( e ) {
112
113
this . logService . error ( 'Failed to initialize ssh proxy config' , e ) ;
113
114
114
115
let sendErrorReport = true ;
115
- failureCode = 'Unknown' ;
116
+ let failureCode : FailedToInitializeCode = 'Unknown' ;
116
117
if ( e ?. code ) {
117
118
failureCode = e . code ;
118
119
sendErrorReport = ! IgnoredFailedCodes . includes ( e . code ) ;
@@ -123,11 +124,10 @@ export class LocalSSHService extends Disposable implements ILocalSSHService {
123
124
if ( sendErrorReport ) {
124
125
this . telemetryService . sendTelemetryException ( e , { gitpodHost : this . hostService . gitpodHost , useLocalAPP : String ( Configuration . getUseLocalApp ( ) ) } ) ;
125
126
}
126
- this . isSupportLocalSSH = false ;
127
- }
128
127
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
+ }
131
131
}
132
132
133
133
private async configureSettings ( { proxyScript, launcher } : { proxyScript : string ; launcher : string } ) {
0 commit comments