-
Notifications
You must be signed in to change notification settings - Fork 4
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
입찰 시 이전 사용자에게 알림을 보낼 때 Optional 로직 변경 #735
Conversation
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.
지토 좋은 제안 감사합니다!
그런데 궁금한 점이 있어 질문드립니다!
auction.findLastBidder() | ||
.ifPresent(previousBidder -> | ||
publishBidNotificationEvent(auctionImageAbsoluteUrl, auctionAndImageDto, previousBidder)); | ||
|
||
publishBidNotificationEvent(auctionImageAbsoluteUrl, auctionAndImageDto, previousBidder); | ||
|
||
return saveBid.getId(); | ||
return saveAndUpdateLastBid(bidDto, auction, bidder).getId(); |
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.
그러네요 그 부분은 놓쳤습니다
순서를 변경하도록 하겠습니다
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.
피드백 반영 확인해 approve 합니다~
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.
제이미 예리하네요 👍🏻
근데 제가 이해하기로는 @TransactionalEventListener
가 기존 트랜잭션이 커밋된 이후에 수행되기 때문에 순서는 크게 상관 없을 것 같긴합니다. 근데 변경된 게 직관적으로 이해하기에 편한 것 같아요!
언급한 이유는 그냥 어제 디스커션 쓰면서 고민했던 부분이라 한 번 말해보고 싶었습니다 ㅎ
final Bid saveBid = saveAndUpdateLastBid(bidDto, auction, bidder); | ||
|
||
publishBidNotificationEvent(auctionImageAbsoluteUrl, auctionAndImageDto, previousBidder); | ||
auction.findLastBidder() | ||
.ifPresent(previousBidder -> | ||
publishBidNotificationEvent(auctionImageAbsoluteUrl, auctionAndImageDto, previousBidder)); |
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.
필수
saveAndUpdateLastBid()
를 수행하고 나서 findLastBidder()
를 하게 되면 saveAndUpdateLastBid()
를 수행해서 lastBidder가 바뀐 뒤에 findLastBidder()
가 수행되게 됩니다. 그러면 알림 대상이 이전 입찰자가 아니라 현재 입찰하고 있는 사람이 되기 때문에 findLastBidder()
를 하고 나서 saveAndUpadateLastBid()
를 해주어야 합니다.
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.
헐 그러네요 엔초........
왜 저는 이걸 생각 못했을까요..?
엔초 진짜 멋지다..
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.
확인했습니다. 감사합니다.
일단 닫겠습니다 |
📄 작업 내용 요약
입찰 시 이전 사용자에게 알림을 보낼 때 Optional 로직 변경
🙋🏻 리뷰 시 주의 깊게 확인해야 하는 코드
📎 Issue 번호