Skip to content

fix: 랭킹 보상 포인트 지급을 PointService 원자 경로로 위임 - #425

Merged
soyeon1806 merged 1 commit into
devfrom
fix/ranking-atomic-point-award
Jul 15, 2026
Merged

fix: 랭킹 보상 포인트 지급을 PointService 원자 경로로 위임#425
soyeon1806 merged 1 commit into
devfrom
fix/ranking-atomic-point-award

Conversation

@soyeon1806

@soyeon1806 soyeon1806 commented Jul 15, 2026

Copy link
Copy Markdown
Collaborator

✅ PR 설명

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

🏗 작업 내용

  • RankingScheduler.awardWeeklyPoints의 findByUserId + addPoints + save + 수동 PointHistory 저장을 pointService.earnPoints(user, reason)로 교체

📸 테스트 결과 (선택)

  • RankingSchedulerTest 1/1

🔗 관련 이슈 (선택)

관련된 Issue가 있다면 #이슈번호 형식으로 작성해주세요.

🚨 참고 사항 (선택)

리뷰어가 참고해야 할 사항이 있다면 작성해주세요.

@soyeon1806 soyeon1806 self-assigned this Jul 15, 2026
@soyeon1806
soyeon1806 merged commit 43224bd into dev Jul 15, 2026
2 checks passed
@soyeon1806
soyeon1806 deleted the fix/ranking-atomic-point-award branch July 15, 2026 14:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant