Repository navigation
Conversation
하루 한도 검사가 그날 회원의 기존 예약 행만 잠가, 기존 예약이 없는 날에는 같은 회원의 동시 요청(겹치지 않는 2시간 + 2시간)이 둘 다 통과해 4시간이 예약됐다. - 예약 생성 시 회원 행을 잠가 한 회원의 예약 생성을 직렬화한다. - 반복 예약 저장 중 다른 회원과의 동시 충돌(배타 제약 위반)을 단건과 같이 409로 바꾼다 (이전: 일반 400, 전체 롤백은 동일).
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 42 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
요약
하루 이용 한도(3시간) 검사가 그날 회원의 기존 예약 행만 잠갔다(
findActiveByMemberIdAndDateForUpdate). 기존 예약이 없는 날에는 잠글 행이 없어, 같은 회원이 겹치지 않는 2시간 예약 두 건을 동시에 보내면 둘 다 통과해 4시간이 예약됐다.변경
memberRepository.findByIdForUpdate) 한 회원의 예약 생성을 직렬화한다. 생성 트랜잭션은 외부 호출 없이 짧다.409 OVERLAPPING_RESERVATION으로 응답한다(이전: 전역 처리기의 일반 400). JPA에서는 한 건만 되돌리는 세이브포인트를 쓸 수 없어 전체 롤백은 이전과 같다 — 다시 요청하면 겹친 날짜는 건너뛰고 생성된다.테스트
ReservationConcurrencyTest에 추가: 같은 회원이 빈 날에 10:00–12:00, 13:00–15:00을 동시에 요청하면 하나는 200, 하나는 409, 예약은 1건(5일 반복).[200, 200]으로 실패함을 확인했다../gradlew test: 550건 중 549 통과, 1 스킵.