@@ -16,7 +16,6 @@ import { timeout } from './common/async';
16
16
import { MetricsReporter , getConnectMetricsInterceptor } from './metrics' ;
17
17
import { ILogService } from './services/logService' ;
18
18
import { WrapError } from './common/utils' ;
19
- import { ITelemetryService } from './common/telemetry' ;
20
19
21
20
function isTelemetryEnabled ( ) : boolean {
22
21
const TELEMETRY_CONFIG_ID = 'telemetry' ;
@@ -60,7 +59,6 @@ export class GitpodPublicApi extends Disposable implements IGitpodAPI {
60
59
private readonly accessToken : string ,
61
60
private readonly gitpodHost : string ,
62
61
private readonly logger : ILogService ,
63
- private readonly telemetryService : ITelemetryService
64
62
) {
65
63
super ( ) ;
66
64
@@ -97,70 +95,70 @@ export class GitpodPublicApi extends Disposable implements IGitpodAPI {
97
95
}
98
96
99
97
async listWorkspaces ( ) : Promise < Workspace [ ] > {
100
- return this . _wrapError ( this . _workaroundGoAwayBug ( async ( ) => {
98
+ return this . _wrapError ( async ( ) => {
101
99
const response = await this . workspaceService . listWorkspaces ( { } ) ;
102
100
return response . result ;
103
- } ) ) ;
101
+ } ) ;
104
102
}
105
103
106
104
async getWorkspace ( workspaceId : string , signal ?: AbortSignal ) : Promise < Workspace > {
107
- return this . _wrapError ( this . _workaroundGoAwayBug ( async ( ) => {
105
+ return this . _wrapError ( async ( ) => {
108
106
const response = await this . workspaceService . getWorkspace ( { workspaceId } ) ;
109
107
return response . result ! ;
110
- } ) , { signal } ) ;
108
+ } , { signal } ) ;
111
109
}
112
110
113
111
async startWorkspace ( workspaceId : string ) : Promise < Workspace > {
114
- return this . _wrapError ( this . _workaroundGoAwayBug ( async ( ) => {
112
+ return this . _wrapError ( async ( ) => {
115
113
const response = await this . workspaceService . startWorkspace ( { workspaceId } ) ;
116
114
return response . result ! ;
117
- } ) ) ;
115
+ } ) ;
118
116
}
119
117
120
118
async stopWorkspace ( workspaceId : string ) : Promise < Workspace > {
121
- return this . _wrapError ( this . _workaroundGoAwayBug ( async ( ) => {
119
+ return this . _wrapError ( async ( ) => {
122
120
const response = await this . workspaceService . stopWorkspace ( { workspaceId } ) ;
123
121
return response . result ! ;
124
- } ) ) ;
122
+ } ) ;
125
123
}
126
124
127
125
async deleteWorkspace ( workspaceId : string ) : Promise < void > {
128
- return this . _wrapError ( this . _workaroundGoAwayBug ( async ( ) => {
126
+ return this . _wrapError ( async ( ) => {
129
127
await this . workspaceService . deleteWorkspace ( { workspaceId } ) ;
130
- } ) ) ;
128
+ } ) ;
131
129
}
132
130
133
131
async getOwnerToken ( workspaceId : string , signal ?: AbortSignal ) : Promise < string > {
134
- return this . _wrapError ( this . _workaroundGoAwayBug ( async ( ) => {
132
+ return this . _wrapError ( async ( ) => {
135
133
const response = await this . workspaceService . getOwnerToken ( { workspaceId } ) ;
136
134
return response . token ;
137
- } ) , { signal } ) ;
135
+ } , { signal } ) ;
138
136
}
139
137
140
138
async getSSHKeys ( ) : Promise < SSHKey [ ] > {
141
- return this . _wrapError ( this . _workaroundGoAwayBug ( async ( ) => {
139
+ return this . _wrapError ( async ( ) => {
142
140
const response = await this . userService . listSSHKeys ( { } ) ;
143
141
return response . keys ;
144
- } ) ) ;
142
+ } ) ;
145
143
}
146
144
147
145
async sendHeartbeat ( workspaceId : string ) : Promise < void > {
148
- return this . _wrapError ( this . _workaroundGoAwayBug ( async ( ) => {
146
+ return this . _wrapError ( async ( ) => {
149
147
await this . ideClientService . sendHeartbeat ( { workspaceId } ) ;
150
- } ) ) ;
148
+ } ) ;
151
149
}
152
150
153
151
async sendDidClose ( workspaceId : string ) : Promise < void > {
154
- return this . _wrapError ( this . _workaroundGoAwayBug ( async ( ) => {
152
+ return this . _wrapError ( async ( ) => {
155
153
await this . ideClientService . sendDidClose ( { workspaceId } ) ;
156
- } ) ) ;
154
+ } ) ;
157
155
}
158
156
159
157
async getAuthenticatedUser ( ) : Promise < User | undefined > {
160
- return this . _wrapError ( this . _workaroundGoAwayBug ( async ( ) => {
158
+ return this . _wrapError ( async ( ) => {
161
159
const response = await this . userService . getAuthenticatedUser ( { } ) ;
162
160
return response . user ;
163
- } ) ) ;
161
+ } ) ;
164
162
}
165
163
166
164
workspaceStatusStreaming ( workspaceId : string ) {
@@ -176,7 +174,7 @@ export class GitpodPublicApi extends Disposable implements IGitpodAPI {
176
174
if ( isDisposed ) { return ; }
177
175
178
176
try {
179
- const resp = await this . _workaroundGoAwayBug ( ( ) => this . workspaceService . getWorkspace ( { workspaceId } ) ) ( ) ;
177
+ const resp = await this . workspaceService . getWorkspace ( { workspaceId } ) ;
180
178
if ( isDisposed ) { return ; }
181
179
emitter . fire ( resp . result ! . status ! ) ;
182
180
} catch ( err ) {
@@ -225,15 +223,6 @@ export class GitpodPublicApi extends Disposable implements IGitpodAPI {
225
223
return ;
226
224
}
227
225
this . logger . error ( `Error in streamWorkspaceStatus for ${ workspaceId } ` , e ) ;
228
-
229
- // Workaround https://github.com/bufbuild/connect-es/issues/680
230
- // Remove this once it's fixed upstream
231
- const message : string = e . stack || e . message || `${ e } ` ;
232
- if ( message . includes ( 'New streams cannot be created after receiving a GOAWAY' ) ) {
233
- this . telemetryService . sendTelemetryException ( e ) ;
234
- this . logger . error ( 'Got GOAWAY bug, recreating connect client' ) ;
235
- this . createClients ( ) ;
236
- }
237
226
}
238
227
}
239
228
@@ -258,27 +247,6 @@ export class GitpodPublicApi extends Disposable implements IGitpodAPI {
258
247
return callback ( ) . catch ( onError ) ;
259
248
}
260
249
261
- private _workaroundGoAwayBug < T > ( callback : ( ) => Promise < T > ) : ( ) => Promise < T > {
262
- return async ( ) => {
263
- try {
264
- return await callback ( ) ;
265
- } catch ( e ) {
266
- // Workaround https://github.com/bufbuild/connect-es/issues/680
267
- // Remove this once it's fixed upstream
268
- const message : string = e . stack || e . message || `${ e } ` ;
269
- if ( message . includes ( 'New streams cannot be created after receiving a GOAWAY' ) ) {
270
- this . telemetryService . sendTelemetryException ( e ) ;
271
- this . logger . error ( 'Got GOAWAY bug, recreating connect client' ) ;
272
- this . createClients ( ) ;
273
-
274
- return await callback ( ) ;
275
- } else {
276
- throw e ;
277
- }
278
- }
279
- } ;
280
- }
281
-
282
250
public override dispose ( ) {
283
251
super . dispose ( ) ;
284
252
for ( const { dispose } of this . workspaceStatusStreamMap . values ( ) ) {
0 commit comments