-
Notifications
You must be signed in to change notification settings - Fork 0
feat(Store,Reservation): 예약 많은/적은순 정렬 로직 개선 #151
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The head ref may contain hidden characters: "feature/#147-store\uB300\uAE30\uC778\uC6D0\uC21C\uC815\uB82C"
Conversation
- redis.keys()로 다 불러오는 로직 ->scan*cursor 활용
Walkthrough이 변경사항은 두 가지 주요 영역을 다룹니다. 첫째, ReservationController의 updateEntry 엔드포인트의 HTTP 메서드가 POST에서 PATCH로 변경되었습니다. 둘째, StoreServiceImpl에서 Redis 키 검색 로직이 키스 명령어에서 커서 기반 SCAN 방식으로 리팩터링되었으며, Redis 연결 처리와 데이터 필터링 및 정렬 로직이 개선되었습니다. Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant ReservationController
participant StoreServiceImpl
participant Redis
participant Database
Client->>ReservationController: PATCH /admin/update/{storeId}/{userId}/{status}
ReservationController-->>Client: 응답 반환
Client->>StoreServiceImpl: getStoresByWaitingCount(desc)
StoreServiceImpl->>Redis: SCAN "waiting:[0-9]*"
loop 각 키마다
StoreServiceImpl->>Redis: TYPE, ZCARD
StoreServiceImpl->>Database: findById(storeId)
end
StoreServiceImpl-->>Client: 정렬된 StoreWaitingInfo 리스트 반환
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~15–20 minutes Possibly related PRs
Suggested reviewers
Note ⚡️ Unit Test Generation is now available in beta!Learn more here, or try it out under "Finishing Touches" below. ✨ Finishing Touches
🧪 Generate unit tests
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
nowait-app-user-api/src/main/java/com/nowait/applicationuser/store/service/StoreServiceImpl.java (1)
221-239: 리소스 관리와 타입 체크가 잘 구현되었습니다try-with-resources를 사용한 Cursor 관리와 zset 타입 확인이 적절합니다. 다만
Long.valueOf(storeId)부분에서 NumberFormatException이 발생할 가능성이 있으니 예외 처리를 추가하는 것을 고려해보세요.- String storeName = storeRepository.findById(Long.valueOf(storeId)) - .map(Store::getName) - .orElse(UNKNOWN_STORE_NAME); + String storeName; + try { + storeName = storeRepository.findById(Long.valueOf(storeId)) + .map(Store::getName) + .orElse(UNKNOWN_STORE_NAME); + } catch (NumberFormatException e) { + storeName = UNKNOWN_STORE_NAME; + }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
nowait-app-admin-api/src/main/java/com/nowait/applicationadmin/reservation/controller/ReservationController.java(1 hunks)nowait-app-user-api/src/main/java/com/nowait/applicationuser/store/service/StoreServiceImpl.java(3 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
nowait-app-admin-api/src/main/java/com/nowait/applicationadmin/reservation/controller/ReservationController.java (2)
nowait-app-admin-api/src/main/java/com/nowait/applicationadmin/reservation/service/ReservationService.java (1)
processEntryStatus(167-185)nowait-domain/domain-core-rdb/src/main/java/com/nowait/domaincorerdb/reservation/entity/Reservation.java (1)
Reservation(26-60)
🔇 Additional comments (3)
nowait-app-admin-api/src/main/java/com/nowait/applicationadmin/reservation/controller/ReservationController.java (1)
69-69: HTTP 메서드 변경이 적절합니다예약 상태를 부분적으로 업데이트하는 작업에
@PatchMapping을 사용하는 것이 RESTful API 규칙에 더 부합합니다.nowait-app-user-api/src/main/java/com/nowait/applicationuser/store/service/StoreServiceImpl.java (2)
213-216: SCAN 명령어 사용이 적절합니다
keys()대신 cursor 기반 SCAN을 사용한 것은 운영 환경에서 Redis 블로킹을 방지하는 좋은 개선사항입니다.count(1000)값은 실제 데이터 규모에 따라 조정이 필요할 수 있습니다.
249-255: 안전한 Redis 연결 처리가 잘 구현되었습니다Redis 연결 팩토리의 null 체크와 명확한 예외 메시지로 방어적 프로그래밍이 잘 적용되었습니다.
작업 요약
Issue Link
문제점 및 어려움
해결 방안
Reference
Summary by CodeRabbit