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.
안녕하세요 카피 ~!! 🐒
리뷰 받게 되어 영광입니다 :>
복제 지연을 해결하기 위해 두 가지 방법을 생각했었는데요,
선택한 방법은 2번입니다!
1번은 적당한 timeout을 가지면 베스트인 방법이라고 생각했으나, 따로 mysql에 플러그인을 설치해야하는 점이 단점으로 다가왔어요. 이는 코드로 해결할 수 있는 부분이 아니며, DB가 변경되면 변경된 DB에 다시 설치가 필요하고 해당 기능을 지원하지 않을 수도 있다고 판단했어요. 그리고 궁극적으로 시도하다가 실패했습니다. 제가 공부한 설정 외에 다른 설정도 필요한 것 같아요.
MySQL 공식문서
3번의 경우에는 쿠폰이라는 도메인이 어찌보면 기간이 짧은 이벤트성이라고 생각을 합니다. 그리고 돈과 관련된 만큼 유효기간이 지난 것이 캐시에 갱신되지 않는다면 조회될 가능성이 있을 것 같습니다.
그래서 2번을 사용하게 되었어요. 허나 Writer에서 다시 조회하는 메서드는 private으로 만들어 외부에서 사용하지 못하게 하였고, readOnly가 아닌 새로운 트랜잭션을 사용하도록 하는 부분을 재사용 가능하게 클래스로 만들었습니다.
리뷰 잘 부탁드려요 😊