From d1df6594af41a245b81602f4a6d6dca3b9e71fd0 Mon Sep 17 00:00:00 2001 From: Philip Gai Date: Mon, 4 Apr 2022 18:54:19 +0000 Subject: [PATCH] Delete the refresh token at the end --- .../src/eventHandlers/pullRequestEventHandler.ts | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/web-app/src/eventHandlers/pullRequestEventHandler.ts b/web-app/src/eventHandlers/pullRequestEventHandler.ts index 1627263..d4bee8e 100644 --- a/web-app/src/eventHandlers/pullRequestEventHandler.ts +++ b/web-app/src/eventHandlers/pullRequestEventHandler.ts @@ -229,16 +229,15 @@ Please fix the issues and recreate a new PR: } catch (err) { const errorMessage = HelperService.getErrorMessage(err); logger.error(errorMessage); - } finally { - // Delete the token to avoid conflicts with prod - const appId = this._configService.appConfig.appId; - if (appId !== ConfigService.prodAppId) { - logger.info(`Current app (${appId}) is not prod, deleting ${authorLogin}'s refresh token`); - this._tokenService.deleteRefreshToken(authorLogin); - } } } } + // Delete the token to avoid conflicts with prod + const appId = this._configService.appConfig.appId; + if (appId !== ConfigService.prodAppId) { + logger.info(`Current app (${appId}) is not prod, deleting ${authorLogin}'s refresh token`); + await this._tokenService.deleteRefreshToken(authorLogin); + } logger.info("Exiting pull_request.closed handler"); };