Skip to content

Commit

Permalink
fix: 인터페이스 분리로 인한 side effect 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
eckrin committed Aug 13, 2024
1 parent 1b2541e commit 114e78d
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public CompletableFuture<CommonResponse<ArrivalApplicationResponseDto>> arrivalE
return arrivalEventService.applyEvent(authInfo)
.thenApply(result -> new CommonResponse<>(result))
.exceptionally(ex -> {
// 내부 예외 처리
if(ex.getCause() instanceof ExistingUserException) {
throw new ExistingUserException("[비동기 에러] 유저가 이미 존재합니다.");
} else {
Expand Down
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -44,6 +45,7 @@ public void setEventArrivalCount() {
// 찾은 이벤트에 해당하는 reword개수 조회
int rewordCount = eventRewardRepository.countByEvent(findEvent);

ArrivalEventReleaseService.setMaxArrival(rewordCount);
ArrivalEventReleaseServiceRedisImpl.setMaxArrival(rewordCount);
ArrivalEventReleaseServiceJavaImpl.setMaxArrival(rewordCount);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -14,10 +13,9 @@
@RequiredArgsConstructor
public class ArrivalEventService {

private final ArrivalEventReleaseService arrivalEventReleaseService;
private final ArrivalEventReleaseService arrivalEventReleaseServiceRedisImpl;

@Transactional
public CompletableFuture<ArrivalApplicationResponseDto> applyEvent(AuthInfo authInfo) {
return arrivalEventReleaseService.applyEvent(authInfo);
return arrivalEventReleaseServiceRedisImpl.applyEvent(authInfo);
}
}

0 comments on commit 114e78d

Please sign in to comment.