From 114e78d9ac87741ee28ee6ef2ed06d0e089be2c2 Mon Sep 17 00:00:00 2001 From: eckrin Date: Tue, 13 Aug 2024 15:39:53 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=EC=9D=B8=ED=84=B0=ED=8E=98=EC=9D=B4?= =?UTF-8?q?=EC=8A=A4=20=EB=B6=84=EB=A6=AC=EB=A1=9C=20=EC=9D=B8=ED=95=9C=20?= =?UTF-8?q?side=20effect=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../event/controller/ArrivalEventController.java | 1 + .../event/model/dto/ArrivalApplicationResponseDto.java | 4 ++-- .../event/scheduler/ArrivalEventMaxArrivalScheduler.java | 6 ++++-- .../podoarrival/event/service/ArrivalEventService.java | 6 ++---- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/softeer/podoarrival/event/controller/ArrivalEventController.java b/src/main/java/com/softeer/podoarrival/event/controller/ArrivalEventController.java index a61d0ca..9d6c6bc 100644 --- a/src/main/java/com/softeer/podoarrival/event/controller/ArrivalEventController.java +++ b/src/main/java/com/softeer/podoarrival/event/controller/ArrivalEventController.java @@ -32,6 +32,7 @@ public CompletableFuture> arrivalE return arrivalEventService.applyEvent(authInfo) .thenApply(result -> new CommonResponse<>(result)) .exceptionally(ex -> { + // 내부 예외 처리 if(ex.getCause() instanceof ExistingUserException) { throw new ExistingUserException("[비동기 에러] 유저가 이미 존재합니다."); } else { diff --git a/src/main/java/com/softeer/podoarrival/event/model/dto/ArrivalApplicationResponseDto.java b/src/main/java/com/softeer/podoarrival/event/model/dto/ArrivalApplicationResponseDto.java index 79c06aa..5daa92e 100644 --- a/src/main/java/com/softeer/podoarrival/event/model/dto/ArrivalApplicationResponseDto.java +++ b/src/main/java/com/softeer/podoarrival/event/model/dto/ArrivalApplicationResponseDto.java @@ -1,10 +1,10 @@ package com.softeer.podoarrival.event.model.dto; import lombok.AllArgsConstructor; -import lombok.Data; +import lombok.Getter; import lombok.NoArgsConstructor; -@Data +@Getter @AllArgsConstructor @NoArgsConstructor public class ArrivalApplicationResponseDto { diff --git a/src/main/java/com/softeer/podoarrival/event/scheduler/ArrivalEventMaxArrivalScheduler.java b/src/main/java/com/softeer/podoarrival/event/scheduler/ArrivalEventMaxArrivalScheduler.java index f6154a0..5f1e15a 100644 --- a/src/main/java/com/softeer/podoarrival/event/scheduler/ArrivalEventMaxArrivalScheduler.java +++ b/src/main/java/com/softeer/podoarrival/event/scheduler/ArrivalEventMaxArrivalScheduler.java @@ -6,7 +6,8 @@ import com.softeer.podoarrival.event.repository.EventRepository; import com.softeer.podoarrival.event.repository.EventRewardRepository; import com.softeer.podoarrival.event.repository.EventTypeRepository; -import com.softeer.podoarrival.event.service.ArrivalEventReleaseService; +import com.softeer.podoarrival.event.service.ArrivalEventReleaseServiceJavaImpl; +import com.softeer.podoarrival.event.service.ArrivalEventReleaseServiceRedisImpl; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.scheduling.annotation.Scheduled; @@ -44,6 +45,7 @@ public void setEventArrivalCount() { // 찾은 이벤트에 해당하는 reword개수 조회 int rewordCount = eventRewardRepository.countByEvent(findEvent); - ArrivalEventReleaseService.setMaxArrival(rewordCount); + ArrivalEventReleaseServiceRedisImpl.setMaxArrival(rewordCount); + ArrivalEventReleaseServiceJavaImpl.setMaxArrival(rewordCount); } } diff --git a/src/main/java/com/softeer/podoarrival/event/service/ArrivalEventService.java b/src/main/java/com/softeer/podoarrival/event/service/ArrivalEventService.java index 2a6f99d..af9615b 100644 --- a/src/main/java/com/softeer/podoarrival/event/service/ArrivalEventService.java +++ b/src/main/java/com/softeer/podoarrival/event/service/ArrivalEventService.java @@ -5,7 +5,6 @@ import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; import java.util.concurrent.CompletableFuture; @@ -14,10 +13,9 @@ @RequiredArgsConstructor public class ArrivalEventService { - private final ArrivalEventReleaseService arrivalEventReleaseService; + private final ArrivalEventReleaseService arrivalEventReleaseServiceRedisImpl; - @Transactional public CompletableFuture applyEvent(AuthInfo authInfo) { - return arrivalEventReleaseService.applyEvent(authInfo); + return arrivalEventReleaseServiceRedisImpl.applyEvent(authInfo); } }