Merged
Conversation
|
Caution Review failedPull request was closed or merged during review 📝 WalkthroughWalkthrough피크타임(1시~3시) 동안 좋아요 점수에 2배 배수를 적용하는 이벤트 기능이 추가되었습니다. 동시에 메서드 인자 타입 불일치 예외에 대한 전역 예외 처리기도 추가되었습니다. Changes
Sequence DiagramsequenceDiagram
participant Client
participant BoothLikeService
participant Config
participant TimeProvider as TimeProvider<br/>(Seoul TZ)
Client->>BoothLikeService: like(boothId)
activate BoothLikeService
BoothLikeService->>BoothLikeService: getLikeMultiplier()
activate BoothLikeService
BoothLikeService->>Config: doubleEventEnabled?
Config-->>BoothLikeService: true/false
alt Event Enabled
BoothLikeService->>TimeProvider: getCurrentTime(Seoul)
TimeProvider-->>BoothLikeService: current time
BoothLikeService->>BoothLikeService: check if within<br/>doubleEventStart~End
alt Within Event Window
BoothLikeService-->>BoothLikeService: return 2
else Outside Window
BoothLikeService-->>BoothLikeService: return 1
end
else Event Disabled
BoothLikeService-->>BoothLikeService: return 1
end
deactivate BoothLikeService
BoothLikeService->>BoothLikeService: score = baseScore × multiplier
BoothLikeService-->>Client: success response
deactivate BoothLikeService
Estimated Code Review Effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 3❌ Failed checks (2 warnings, 1 inconclusive)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
📝 Coding Plan
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 |
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.
관련 이슈
설계 상세
1. 좋아요 2배 이벤트 — LocalTime 기반 multiplier
핵심 의사결정: Redis flag 방식 대신 LocalTime 체크 채택
Redis flag 방식은 이벤트 on/off를 즉시 반영할 수 있지만, Blue-Green 배포 시
신구 서버가 동일한 Redis key를 바라보면 배포 도중 이벤트 적용 여부가 불일치할 수 있음.
시간 기반 체크는 공유 상태가 없어 어떤 서버 인스턴스든 동일하게 동작하며, 추가 Redis I/O도 없음.
multiplier 계산만 별도 메서드로 분리하여 기존
like()흐름을 변경하지 않음.env 외부화 — 재빌드 없이 이벤트 시간 변경
@ConfigurationPropertiesrecord를 사용해 타입 안전하게 바인딩.2. Rate Limiting — 필터 체인 3단계 구성
좋아요 도배 방지를 서비스 레이어가 아닌 필터 레이어에서 차단.
서비스 레이어까지 요청이 도달하기 전에 429를 반환하므로 DB/Redis 부하를 줄임.
LikeRateLimiter — Redis increment 기반 슬라이딩 카운터
key가 처음 생성될 때(
newCount == 1)만 TTL을 설정해 window를 고정.LikeRateLimitFilter — /booths/*/likes 경로만 적용
정규식으로 경로를 판단해 다른 API에는 필터가 개입하지 않음.
Rate Limit 초과 시 서비스 레이어 없이 필터에서 즉시 429 반환.
FilterConfig — 필터 등록 및 쿠키 설정 외부화
쿠키 속성(max-age, SameSite, Secure)을 FilterConfig에서 주입받아
DeviceIdCookieFilter에 전달. 필터 내부에 설정을 하드코딩하지 않음.테스트 시나리오
LIKE_DOUBLE_EVENT_ENABLED=false→ 시간대 내에도 1배로 적용되는지 확인환경변수 설정 예시