Merged
Conversation
minsoo0506
approved these changes
Apr 8, 2026
Collaborator
minsoo0506
left a comment
There was a problem hiding this comment.
확인했어용:) redis 안쓰고 db 비관적 락을 사용했군요. 트랜잭션 점유시간이 길긴하지만 CTF처럼 충돌이 극심한 상태가 아니니 괜찮을 것 같습니다. 고생했어요 😎
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix: 과제 중복 제출 - 비관적 락
DB 단에서 하지 않고 일단 비관적 락을 적용해 해결하는 방향으로 잡았습니다

CTF때보다는 간단하게 코드를 짠 거 같은데 운영 단계에서 잘 되길 빕니다...
문제
해결 방법
변경 사항
PlanRepository@Lock(LockModeType.PESSIMISTIC_WRITE)적용한findByIdWithPessimisticLock쿼리 추가AssignmentSubmissionServicePlanRepository의존성 추가submitAssignment에서 락 획득 → 중복 체크 순서로 호출getSubmissionStatistics의 제출 수 집계를 변경 (혹시 중복이 생겼을 때도 인원 수가 정확히 반영되도록 수정)테스트
AssignmentSubmissionServiceTest: 락 획득 순서 보장, 락 실패 시 후속 단계 미실행, 중복 차단 검증AssignmentSubmissionConcurrencyTest: 동시 5개 요청 중 1개만 성공하는 것 검증