@@ -16,7 +16,6 @@ import { timeout } from './common/async';
1616import { MetricsReporter , getConnectMetricsInterceptor } from './metrics' ;
1717import { ILogService } from './services/logService' ;
1818import { WrapError } from './common/utils' ;
19- import { ITelemetryService } from './common/telemetry' ;
2019
2120function isTelemetryEnabled ( ) : boolean {
2221 const TELEMETRY_CONFIG_ID = 'telemetry' ;
@@ -60,7 +59,6 @@ export class GitpodPublicApi extends Disposable implements IGitpodAPI {
6059 private readonly accessToken : string ,
6160 private readonly gitpodHost : string ,
6261 private readonly logger : ILogService ,
63- private readonly telemetryService : ITelemetryService
6462 ) {
6563 super ( ) ;
6664
@@ -97,70 +95,70 @@ export class GitpodPublicApi extends Disposable implements IGitpodAPI {
9795 }
9896
9997 async listWorkspaces ( ) : Promise < Workspace [ ] > {
100- return this . _wrapError ( this . _workaroundGoAwayBug ( async ( ) => {
98+ return this . _wrapError ( async ( ) => {
10199 const response = await this . workspaceService . listWorkspaces ( { } ) ;
102100 return response . result ;
103- } ) ) ;
101+ } ) ;
104102 }
105103
106104 async getWorkspace ( workspaceId : string , signal ?: AbortSignal ) : Promise < Workspace > {
107- return this . _wrapError ( this . _workaroundGoAwayBug ( async ( ) => {
105+ return this . _wrapError ( async ( ) => {
108106 const response = await this . workspaceService . getWorkspace ( { workspaceId } ) ;
109107 return response . result ! ;
110- } ) , { signal } ) ;
108+ } , { signal } ) ;
111109 }
112110
113111 async startWorkspace ( workspaceId : string ) : Promise < Workspace > {
114- return this . _wrapError ( this . _workaroundGoAwayBug ( async ( ) => {
112+ return this . _wrapError ( async ( ) => {
115113 const response = await this . workspaceService . startWorkspace ( { workspaceId } ) ;
116114 return response . result ! ;
117- } ) ) ;
115+ } ) ;
118116 }
119117
120118 async stopWorkspace ( workspaceId : string ) : Promise < Workspace > {
121- return this . _wrapError ( this . _workaroundGoAwayBug ( async ( ) => {
119+ return this . _wrapError ( async ( ) => {
122120 const response = await this . workspaceService . stopWorkspace ( { workspaceId } ) ;
123121 return response . result ! ;
124- } ) ) ;
122+ } ) ;
125123 }
126124
127125 async deleteWorkspace ( workspaceId : string ) : Promise < void > {
128- return this . _wrapError ( this . _workaroundGoAwayBug ( async ( ) => {
126+ return this . _wrapError ( async ( ) => {
129127 await this . workspaceService . deleteWorkspace ( { workspaceId } ) ;
130- } ) ) ;
128+ } ) ;
131129 }
132130
133131 async getOwnerToken ( workspaceId : string , signal ?: AbortSignal ) : Promise < string > {
134- return this . _wrapError ( this . _workaroundGoAwayBug ( async ( ) => {
132+ return this . _wrapError ( async ( ) => {
135133 const response = await this . workspaceService . getOwnerToken ( { workspaceId } ) ;
136134 return response . token ;
137- } ) , { signal } ) ;
135+ } , { signal } ) ;
138136 }
139137
140138 async getSSHKeys ( ) : Promise < SSHKey [ ] > {
141- return this . _wrapError ( this . _workaroundGoAwayBug ( async ( ) => {
139+ return this . _wrapError ( async ( ) => {
142140 const response = await this . userService . listSSHKeys ( { } ) ;
143141 return response . keys ;
144- } ) ) ;
142+ } ) ;
145143 }
146144
147145 async sendHeartbeat ( workspaceId : string ) : Promise < void > {
148- return this . _wrapError ( this . _workaroundGoAwayBug ( async ( ) => {
146+ return this . _wrapError ( async ( ) => {
149147 await this . ideClientService . sendHeartbeat ( { workspaceId } ) ;
150- } ) ) ;
148+ } ) ;
151149 }
152150
153151 async sendDidClose ( workspaceId : string ) : Promise < void > {
154- return this . _wrapError ( this . _workaroundGoAwayBug ( async ( ) => {
152+ return this . _wrapError ( async ( ) => {
155153 await this . ideClientService . sendDidClose ( { workspaceId } ) ;
156- } ) ) ;
154+ } ) ;
157155 }
158156
159157 async getAuthenticatedUser ( ) : Promise < User | undefined > {
160- return this . _wrapError ( this . _workaroundGoAwayBug ( async ( ) => {
158+ return this . _wrapError ( async ( ) => {
161159 const response = await this . userService . getAuthenticatedUser ( { } ) ;
162160 return response . user ;
163- } ) ) ;
161+ } ) ;
164162 }
165163
166164 workspaceStatusStreaming ( workspaceId : string ) {
@@ -176,7 +174,7 @@ export class GitpodPublicApi extends Disposable implements IGitpodAPI {
176174 if ( isDisposed ) { return ; }
177175
178176 try {
179- const resp = await this . _workaroundGoAwayBug ( ( ) => this . workspaceService . getWorkspace ( { workspaceId } ) ) ( ) ;
177+ const resp = await this . workspaceService . getWorkspace ( { workspaceId } ) ;
180178 if ( isDisposed ) { return ; }
181179 emitter . fire ( resp . result ! . status ! ) ;
182180 } catch ( err ) {
@@ -225,15 +223,6 @@ export class GitpodPublicApi extends Disposable implements IGitpodAPI {
225223 return ;
226224 }
227225 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- }
237226 }
238227 }
239228
@@ -258,27 +247,6 @@ export class GitpodPublicApi extends Disposable implements IGitpodAPI {
258247 return callback ( ) . catch ( onError ) ;
259248 }
260249
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-
282250 public override dispose ( ) {
283251 super . dispose ( ) ;
284252 for ( const { dispose } of this . workspaceStatusStreamMap . values ( ) ) {
0 commit comments