-
Notifications
You must be signed in to change notification settings - Fork 0
예약 대기열 기능을 구현했습니다. #11
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/\uC608\uC57D-\uB300\uAE30\uC5F4-\uAE30\uB2A5-\uAD6C\uD604"
Conversation
| String storeReserveIdx, | ||
| String userIdx | ||
| ) { | ||
| private static final String WAITING_KEY_FORMAT = "store:%s:waiting:%s"; |
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.
version 명도 입력하는게 좋을 것 같습니다~~
ex) v1처럼
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.
말씀해주신 부분이였는데 놓쳤네요..ㅜ
Value 구조가 달라진 경우를 대비할 수 있도록 버저닝을 추가했습니다!
| } | ||
|
|
||
| public ReservesInDayDto getReservesInDay(Long storeIdx, LocalDate date) { | ||
| List<ReserveData> reserveDates = repository.findByStore_IdxAndReserveDate(storeIdx, date); |
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.
"_" 이것은 무엇인가요ㅎㅎ
의도한건가요?
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.
메소드네이밍으로 함수 지을 때 _을 사용할 경우 연관관계 객체의 필드를 사용할 수 있는 것 같더라구요!
Property Expressions 관련 내용을 참고했습니다!
(https://docs.spring.io/spring-data/commons/reference/repositories/query-methods-details.html)
| private final RedisTemplate<String, String> redisTemplate; | ||
|
|
||
| public void registerWaiting(StoreQueueDto storeQueueDto) { | ||
| redisTemplate.opsForZSet().add(storeQueueDto.key(), storeQueueDto.value(), storeQueueDto.score()); |
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.
TTL은 안걸어도 될까요?
그리고 중복 체크도 해야하지 않을까 싶긴합니다
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.
마지막 등록 기준 7분을 유효기간으로 설정하도록 수정했습니다.
7분을 기준으로 잡은 이유는 마지막 대기열 기준으로 7분동안 대기 상태가 유지되기 떄문입니다.
마지막 요청 이후 키가 예약 요청이 없을 경우 대기열은 사라지고, 다시 예약 요청이 진행됐을 때 다시 생성되도록
TTL을 7분으로 주었습니다.
유저 idx의 존재유무에 따라 데이터를 적재할 수 있도록 putIfAbsent 메소드를 사용하도록 수정했습니다!
유저가 있는데 데이터를 삽입할려고 하면 false를 반환받아 에러를 던지도록 했습니다.
yuus95
left a comment
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.
리뷰해주셔서 감사합니다.
관련 내용 수정했습니다!
| private final RedisTemplate<String, String> redisTemplate; | ||
|
|
||
| public void registerWaiting(StoreQueueDto storeQueueDto) { | ||
| redisTemplate.opsForZSet().add(storeQueueDto.key(), storeQueueDto.value(), storeQueueDto.score()); |
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.
마지막 등록 기준 7분을 유효기간으로 설정하도록 수정했습니다.
7분을 기준으로 잡은 이유는 마지막 대기열 기준으로 7분동안 대기 상태가 유지되기 떄문입니다.
마지막 요청 이후 키가 예약 요청이 없을 경우 대기열은 사라지고, 다시 예약 요청이 진행됐을 때 다시 생성되도록
TTL을 7분으로 주었습니다.
유저 idx의 존재유무에 따라 데이터를 적재할 수 있도록 putIfAbsent 메소드를 사용하도록 수정했습니다!
유저가 있는데 데이터를 삽입할려고 하면 false를 반환받아 에러를 던지도록 했습니다.
| String storeReserveIdx, | ||
| String userIdx | ||
| ) { | ||
| private static final String WAITING_KEY_FORMAT = "store:%s:waiting:%s"; |
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.
말씀해주신 부분이였는데 놓쳤네요..ㅜ
Value 구조가 달라진 경우를 대비할 수 있도록 버저닝을 추가했습니다!
| } | ||
|
|
||
| public ReservesInDayDto getReservesInDay(Long storeIdx, LocalDate date) { | ||
| List<ReserveData> reserveDates = repository.findByStore_IdxAndReserveDate(storeIdx, date); |
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.
메소드네이밍으로 함수 지을 때 _을 사용할 경우 연관관계 객체의 필드를 사용할 수 있는 것 같더라구요!
Property Expressions 관련 내용을 참고했습니다!
(https://docs.spring.io/spring-data/commons/reference/repositories/query-methods-details.html)
|



작업 내용
대기열 기능 구현
예약 조회 기능 구현
상점에서 일자별 예약 조회 기능 구현
일자 별로 예약 가능한 리스트 조회 가능
구현 예정