마커 재화 시스템 서버 API 추가 (소비/광고 리워드 적립) - #255
Open
unam98 wants to merge 1 commit into
Open
Conversation
코스를 그릴 때 찍는 마커 개수를 계정 단위 재화로 관리한다. 소비(코스 저장 시 차감)는 조회-비교-차감을 조건부 UPDATE 한 문장으로 합쳐 락 없이 원자적으로 처리하고, 적립(광고 시청 보상)은 MarkerRewardClaim의 유니크 제약으로 같은 리워드 요청이 중복 지급되지 않도록 멱등성을 보장한다. 동시성 테스트(MarkerQuotaConcurrencyTest)로 두 경로 모두 검증: - 잔액보다 많은 소비 요청이 몰려도 잔액이 음수로 내려가지 않음 - 같은 rewardTransactionId로 동시에 요청해도 지급은 정확히 1번만 발생 리워드 지급 경로를 만들며 REQUIRES_NEW 호출부에 별도 @transactional을 씌우면 스레드당 커넥션을 2개씩 점유해 동시 요청이 몰릴 때 커넥션 풀이 예상보다 빨리 고갈될 수 있다는 걸 실제로 재현해 확인하고 수정함. Claude-Session: https://claude.ai/code/session_01SPpjaoQ3Pxfd4624hWZsik
unam98
requested review from
RinRinPARK,
YuSuhwa-ve and
funnysunny08
as code owners
August 25, 2026 08:13
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
5 tasks
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.
작업 배경
변경 사항
RunnectUsermarkerQuotaBalance필드 추가 (기본값 20)UserRepositoryconsumeMarkerQuota/grantMarkerQuota— 조회·비교·차감을 조건부 UPDATE 한 문장으로 처리하는 원자적 쿼리MarkerRewardClaim(신규)(user_id, rewardTransactionId)유니크 제약으로 광고 리워드 중복 지급 방지MarkerRewardGrantExecutor(신규)MarkerQuotaController/MarkerQuotaServiceGET /api/marker-quota,POST /api/marker-quota/consume,POST /api/marker-quota/reward영향 범위
RunnectUser테이블에 컬럼 1개,MarkerRewardClaim테이블 1개가 새로 생성됨 (Hibernateddl-auto: update로 자동 반영).SocialSignUpRegistrar)이 이미AuthService.signIn()에도 있어 잠재적으로 영향받을 수 있는데, 이번 PR 스코프 밖이라 별도로 공유만 함.검증 매트릭스
요청이_몰려도_잔액이_음수로_내려가지_않는다같은_트랜잭션ID로_동시에_요청해도_한_번만_지급된다Test Plan
MarkerQuotaConcurrencyTest2건 로컬 Postgres로 통과 확인🤖 Generated with Claude Code