From a0cd75ec6f556bc45104a0eb862b4b10f928b032 Mon Sep 17 00:00:00 2001 From: rladydgn <39542757+rladydgn@users.noreply.github.com> Date: Fri, 8 Dec 2023 01:48:31 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=EA=B2=BD=EC=9F=81=EC=A1=B0=EA=B1=B4=20?= =?UTF-8?q?=ED=95=B4=EA=B2=B0=20=ED=85=8C=EC=8A=A4=ED=8A=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/competition/services/competition.service.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/be/algo-with-me-api/src/competition/services/competition.service.ts b/be/algo-with-me-api/src/competition/services/competition.service.ts index 5e30f48..d7a4bb7 100644 --- a/be/algo-with-me-api/src/competition/services/competition.service.ts +++ b/be/algo-with-me-api/src/competition/services/competition.service.ts @@ -316,6 +316,13 @@ export class CompetitionService { await queryRunner.startTransaction(); try { + submission = await queryRunner.manager + .getRepository(Submission) + .createQueryBuilder('submission') + .useTransaction(true) + .setLock('pessimistic_write') + .where('id = :id', { id: scoreResultDto.submissionId }) + .getOne(); submission = await queryRunner.manager.findOneBy(Submission, { id: scoreResultDto.submissionId, }); @@ -327,6 +334,7 @@ export class CompetitionService { await queryRunner.commitTransaction(); await queryRunner.release(); } catch (error) { + this.logger.debug(`트랜잭션 실패 ${error.message}`); await queryRunner.rollbackTransaction(); await queryRunner.release(); throw error;