fix: 랭킹 보상 포인트 지급을 PointService 원자 경로로 위임 - #425
Merged
Conversation
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.
✅ PR 설명
주간 랭킹 보상 지급이 Point를 직접 조회해 addPoints() 후 저장하는 read-modify-write 방식이었습니다.
이 때문에 랭킹 배치가 포인트를 적립하는 사이 사용자가 다른 경로(출석이나 방명록 등)로 포인트를 얻으면 lost update가 발생할 수 있었고, 잔액을 바꾸면서도 Redis 잔액 캐시를 무효화하지 않아 캐시가 오래된 값을 반환하는 staleness 버그도 있었습니다.
이에 랭킹 보상 지급을 PointService.earnPoints(user, reason) 단일 경로로 위임했습니다.
(RANK_1/2/3은 이미 PointReason에 금액이 정의되어 있어(직전 통합 작업), 원자적 잔액 증가 + 이력 기록 + 캐시 무효화가 일관되게 처리됩니다.)
🏗 작업 내용
📸 테스트 결과 (선택)
🔗 관련 이슈 (선택)
🚨 참고 사항 (선택)