Skip to content

Commit

Permalink
[FIX] 나머지 입찰자들 내역 저장
Browse files Browse the repository at this point in the history
  • Loading branch information
ssjy4974 committed Jan 21, 2024
1 parent 90aeec3 commit 0211f78
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ public Mono<Void> start(String auctionId) {
.startAuction(auctionId)
.flatMap(
auction -> {
log.info("startAuction", auction.getStartAt());
scheduler.startJob(auctionId);
return chatHandler.broadCastStart(payload);
});
Expand Down
12 changes: 8 additions & 4 deletions src/main/java/com/dailyon/auctionservice/service/BidService.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,8 @@ private Mono<Void> processAuction(Auction auction, Long bid) {
Mono<ReadAuctionDetailResponse.ReadProductDetailResponse> productInfo =
productClient.readProductDetail(auction.getAuctionProductId());

return Mono.zip(
saveSuccessfulBiddersHistory(productInfo, auction, bid),
saveRemainBiddersHistory(productInfo, auction, bid))
return saveSuccessfulBiddersHistory(productInfo, auction, bid)
.then(saveRemainBiddersHistory(productInfo, auction, bid))
.then(sendSqsNotification(auction));
}

Expand Down Expand Up @@ -119,7 +118,11 @@ private Mono<Void> saveRemainBiddersHistory(
.zipWith(Mono.just(bid))
.flatMapMany(
tuple -> createAuctionHistories(auction, tuple.getT1(), tuple.getT2(), false));
return saveAuctionHistories(auctionHistories).then(auctionHistories.collectList()).then();

return auctionHistories
.collectList()
.flatMap(list -> saveAuctionHistories(Flux.fromIterable(list)))
.then();
}

private Mono<Void> sendSqsNotification(Auction auction) {
Expand Down Expand Up @@ -153,6 +156,7 @@ private Flux<AuctionHistory> createAuctionHistories(
return bidders.map(
tuple -> {
BidInfo value = tuple.getValue();
log.info("asdasd {} :", tuple.getValue().getMemberId());
return value.createAuctionHistory(
auction, product, tuple.getScore().longValue(), auctionWinnerBid, isSuccessful);
});
Expand Down

0 comments on commit 0211f78

Please sign in to comment.