-
Notifications
You must be signed in to change notification settings - Fork 2
[Feature/dispatch-rider] 라이더 매칭 기능 구현 #40
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
base: main
Are you sure you want to change the base?
Conversation
f-lab-bright
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.
LGTM with comments
| .map(r -> | ||
| RiderMatchedEvent.builder() | ||
| .riderId(r.getId()) | ||
| .deliveryId(delivery.getId()) | ||
| .orderId(delivery.getOrderId()) | ||
| .build() | ||
| ) | ||
| .forEach(e -> eventPublisher.publishEvent(e)); |
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.
이 부분은 이벤트의 목록을 재사용하는게 아니라면 forEach 하나로 묶어도 되긴 하겠네요
| "주어진 식별자에 해당하는 가게가 없습니다. 가게 ID = " + delivery.getShopId() | ||
| )); | ||
|
|
||
| jpaRiderRepository.findAll().stream() |
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.
라이더수가 많다면 oome가 발생할 수도 있긴 할텐데, 이 부분은 어떻게 최적화할지도 고민해보면 좋겠네요 :)
전체 라이더를 조회하고 가게와의 거리를 계산해 매칭된 라이더에게 이벤트를 발행하도록 구현