Skip to content

Commit

Permalink
[FIX] start
Browse files Browse the repository at this point in the history
  • Loading branch information
ssjy4974 committed Jan 26, 2024
1 parent f0d3880 commit dc76998
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ public Mono<Void> subscribeStartTrigger() {
.flatMap(payload -> objectStringConverter.stringToObject(payload, ChatPayload.class))
.flatMap(
chatPayload -> {
log.info("여기 startjob 쪽임");
Object data = chatPayload.getData();
scheduler.startJob((String) data);
return chatWebSocketHandler.sendMessage(
Expand Down
29 changes: 18 additions & 11 deletions src/main/java/com/dailyon/auctionservice/facade/BidFacade.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.dailyon.auctionservice.chat.response.ChatCommand;
import com.dailyon.auctionservice.chat.response.ChatPayload;
import com.dailyon.auctionservice.chat.scheduler.ChatScheduler;
import com.dailyon.auctionservice.controller.ChatHandler;
import com.dailyon.auctionservice.document.Auction;
import com.dailyon.auctionservice.dto.request.CreateBidRequest;
Expand All @@ -22,6 +23,7 @@ public class BidFacade {
private final BidService bidService;
private final AuctionService auctionService;
private final ChatHandler chatHandler;
private final ChatScheduler scheduler;

public Mono<Long> createBid(CreateBidRequest request, String memberId) {
Auction auction = auctionService.readAuction(request.getAuctionId());
Expand All @@ -43,18 +45,23 @@ public Mono<Void> start(String auctionId) {
ChatPayload<Object> payload = ChatPayload.of(ChatCommand.START, auctionId);
return auctionService
.startAuction(auctionId)
.flatMap(auction -> chatHandler.broadCastStart(payload))
.flatMap(
auction -> {
scheduler.startJob(auctionId);
return chatHandler.broadCastStart(payload);
})
.then();
}

// public Mono<Void> end(String auctionId) {
// log.info("이것도 나오면안댐");
// return auctionService
// .endAuction(auctionId)
// .flatMap(
// auction -> {
// ChatPayload<Object> payload = ChatPayload.of(ChatCommand.AUCTION_CLOSE, auctionId);
// return chatHandler.broadCast(payload).then();
// });
// }
// public Mono<Void> end(String auctionId) {
// log.info("이것도 나오면안댐");
// return auctionService
// .endAuction(auctionId)
// .flatMap(
// auction -> {
// ChatPayload<Object> payload = ChatPayload.of(ChatCommand.AUCTION_CLOSE,
// auctionId);
// return chatHandler.broadCast(payload).then();
// });
// }
}

0 comments on commit dc76998

Please sign in to comment.