diff --git a/packages/api-gateway/src/Service/gRPC/GRPCServiceProxy.ts b/packages/api-gateway/src/Service/gRPC/GRPCServiceProxy.ts index 703040e1f..6c6ce4eb9 100644 --- a/packages/api-gateway/src/Service/gRPC/GRPCServiceProxy.ts +++ b/packages/api-gateway/src/Service/gRPC/GRPCServiceProxy.ts @@ -134,48 +134,21 @@ export class GRPCServiceProxy implements ServiceProxyInterface { request: Request, response: Response, payload?: Record | string, - retryAttempt?: number, ): Promise { - try { - const result = await this.gRPCSyncingServerServiceProxy.sync(request, response, payload) + const result = await this.gRPCSyncingServerServiceProxy.sync(request, response, payload) - response.status(result.status).send({ - meta: { - auth: { - userUuid: response.locals.user?.uuid, - roles: response.locals.roles, - }, - server: { - filesServerUrl: this.filesServerUrl, - }, + response.status(result.status).send({ + meta: { + auth: { + userUuid: response.locals.user?.uuid, + roles: response.locals.roles, }, - data: result.data, - }) - - if (retryAttempt) { - this.logger.debug(`Request to Syncing Server succeeded after ${retryAttempt} retries`, { - userId: response.locals.user ? response.locals.user.uuid : undefined, - }) - } - } catch (error) { - const requestDidNotMakeIt = - 'code' in (error as Record) && (error as Record).code === Status.UNAVAILABLE - - const tooManyRetryAttempts = retryAttempt && retryAttempt > 2 - if (!tooManyRetryAttempts && requestDidNotMakeIt) { - await this.timer.sleep(50) - - const nextRetryAttempt = retryAttempt ? retryAttempt + 1 : 1 - - this.logger.debug(`Retrying request to Syncing Server for the ${nextRetryAttempt} time`, { - userId: response.locals.user ? response.locals.user.uuid : undefined, - }) - - return this.callSyncingServerGRPC(request, response, payload, nextRetryAttempt) - } - - throw error - } + server: { + filesServerUrl: this.filesServerUrl, + }, + }, + data: result.data, + }) } async callRevisionsServer(