-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix : DB 병목 개선 - FindingGameWinner에 데이터 넣을 때 NativeQuery사용 (CC-176) #47
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
성능 얼마나 올랐는지도 알려주세요~~
넴 |
if (completed > 0) { | ||
log.info("선착순 인원 스케쥴링 처리 완료 - {} 건", completed); | ||
} | ||
} | ||
|
||
@Transactional | ||
protected void insertWinner(Integer gameId, String phone) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://mangkyu.tistory.com/269
트랜잭션이 중첩되었을때, 내부 트랜잭션 단위로 커밋을 하고싶은거라면 REQUIRES_NEW
인가요? 궁금!!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
외부트랜잭션 insertWinnerToDatabaseScheduler 에서 내부 트랜잭션이 실패하면 지금까지 커밋된 내용은 반영되고 외부트랜잭션은 그냥 종료시키고 싶었습니다. REQUIRES_NEW를 통해서 새로운 트랜잭션을 만들어야할 것 같아요.
@@ -37,17 +37,21 @@ public void insertWinnerToDatabaseScheduler() { | |||
if (realWinner == null) break; | |||
Integer gameId = realWinner.getGameId(); | |||
String phone = realWinner.getPhone(); | |||
insertWinner(gameId, phone); | |||
try { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
그냥 Exception을 던지고 다른 서비스에서 받는? 그런 로직? (저도잘모름) 도 생각하면 코드 깔끔할 것 같아요
📝 작업내용
실제 조회 대신 프록시 객체 사용💬 침고사항
📖 레퍼런스