refactor(rank): 매출 데이터 없는 경우 redis 초기화 로직 추가#138
Conversation
Walkthrough이 변경사항은 판매 데이터가 없을 때 Redis에 저장된 현재, 이전, 다음 스냅샷 키를 명시적으로 모두 삭제하도록 Changes
Estimated code review effort1 (~2 minutes) ✨ Finishing Touches
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
nowait-app-admin-api/src/main/java/com/nowait/applicationadmin/statistic/scheduler/RankingRefreshScheduler.java (1)
63-66: 매출 데이터 없을 때 Redis 키 정리 로직이 올바르게 구현되었습니다.전체적인 로직은 올바르게 구현되어 있으며, 매출 데이터가 없을 때 모든 스냅샷 키를 정리하는 것은 적절한 접근법입니다.
다만,
nextKey가 중복으로 삭제되고 있습니다 (56번째 줄과 65번째 줄). 기능적으로는 문제가 없지만 불필요한 중복입니다.다음과 같이 중복 제거를 고려해보세요:
private void doRefresh() { String nextKey = RedisKeyUtils.buildNextKey(); String currentKey = RedisKeyUtils.buildCurrentKey(); String previousKey = RedisKeyUtils.buildPreviousKey(); - // 1) 다음 스냅샷 키 초기화 - redis.delete(nextKey); // 2) DB에서 매출 합계 가져와 ZADD List<StoreSales> salesList = statisticCustomRepository.findTotalSales(); if (salesList.isEmpty()) { log.warn("매출 데이터가 없습니다. 다음 스냅샷 키를 초기화합니다."); redis.delete(currentKey); redis.delete(previousKey); redis.delete(nextKey); return; } + // 1) 다음 스냅샷 키 초기화 + redis.delete(nextKey);
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
nowait-app-admin-api/src/main/java/com/nowait/applicationadmin/statistic/scheduler/RankingRefreshScheduler.java(1 hunks)
작업 요약
Issue Link
#137
문제점 및 어려움
해결 방안
Reference
Summary by CodeRabbit