3주차 과제#95
Merged
soonhankwon merged 7 commits intohanghae-skillup:hongs429from Feb 4, 2025
Hidden character warning
The head ref may contain hidden characters: "3\uc8fc\ucc28-\uacfc\uc81c"
Merged
Conversation
…국제화 적용 - GlobalExceptionHandler 정의 - 국제화 도입
- 도메인 로직, application 로직 분리 - Reservation 관련 도메인, jpa 엔티티 만들기 - Flyway로 DDL 반영 - 예외 정의 - 테스트 코드 작성
…key로 동시성 해결 - 테스트 코드로 동시성 검증 - Infra 테스트 환경 구축( test container )
- redission 세팅 - 테스트 코드로 동시성 검증
|
다음주 기간까지 4주차까지 보완하셔서 올려주시면 코드 레벨 + 전체적인 피드백 추가해서 드리겠습니다 :) 화이팅! 리뷰 포인트
|
Author
|
감사합니다! |
|
락을 트랜잭션과 무관하게 별도의 포트로 구현한 것은 적절한 접근이라고 생각합니다 :)
|
Author
|
감사합니다! |
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.
[예약 시스템 구현 및 동시성 제어]
작업 내용
예약과 관련된
application,infra모듈 작업 (presentation미완성)동시성 해결을 위한 이중 방어 적용
ReservationCommandAdapter.reserve(MySQL) → Unique 제약 조건으로 동시성 제어ReservationLockPort(Redisson) → Application 레벨에서 분산 락 적용테스트 전략
application: 단위 테스트 (입력 모델 검증 + 비즈니스 로직 검증)infra:ReservationCommandAdapter.reserve단위 테스트application -> infra경로를 거치는 통합 테스트 진행발생했던 문제와 해결 과정
🚨 문제 1: 통합 테스트를 어떤 모듈에서 작성해야 하는지 고민
application은infra를 모르므로,infra에서 작성해야 하는지 모호함infra는application을 알고 있고 DB 관련 내용도 포함하므로, 통합 테스트는infra에서 작성하는 것으로 결정infra에서는application -> infra가 자연스럽게 연결될 수 있음🚨 문제 2: 락을
application과infra중 어디서 적용할지 고민persistence)에서 락을 걸어야 할까?application레벨에서 비즈니스 로직을 보호해야 할까?ReservationLockPort를application과infra에서 분리application에서 비즈니스 로직 전에 락을 먼저 시도, 이후infra에서 DB 트랜잭션 처리🚨 문제 3: Redisson의
waitTime이 길 경우, 이미 예약된 좌석이 있어도 계속 예약 시도waitTime)이 길면, 이미 예약된 좌석에 대해서도 중복 예약 시도가 발생waitTime을 짧게 설정이번 주차에서 고민되었던 지점이나, 어려웠던 점
infra에서application -> infra흐름을 테스트하는 것이 적절application에 둘지infra에 둘지 판단하는 것이 어려웠음application까지 트랜잭션 전파가 필요할 가능성 존재리뷰 포인트
infra에서 통합 테스트를 작성한 것이 적절한 판단인지?application에서는 트랜잭션을 전파하지 않도록 구현했는데, 이는 올바른 설계인가?application까지 트랜잭션을 잡아야 할 가능성 존재기타 질문
waitTime이 필요한 이유가 명확하지 않음waitTime을 짧게 설정하여 동시 요청을 제한