diff --git a/src/main/java/com/daon/onjung/core/repository/redis/ScheduledEventJobRepository.java b/src/main/java/com/daon/onjung/core/repository/redis/ScheduledEventJobRepository.java index 31e4c57..eee0b51 100644 --- a/src/main/java/com/daon/onjung/core/repository/redis/ScheduledEventJobRepository.java +++ b/src/main/java/com/daon/onjung/core/repository/redis/ScheduledEventJobRepository.java @@ -6,10 +6,11 @@ import org.springframework.stereotype.Repository; import java.util.List; +import java.util.Optional; @Repository public interface ScheduledEventJobRepository extends CrudRepository { @NotNull List findAll(); - void deleteByEventId(Long eventId); + Optional findByEventId(Long eventId); } diff --git a/src/main/java/com/daon/onjung/event/application/controller/consumer/EventSchedulerConsumerV1Controller.java b/src/main/java/com/daon/onjung/event/application/controller/consumer/EventSchedulerConsumerV1Controller.java index 4efb7bf..6ba3e4c 100644 --- a/src/main/java/com/daon/onjung/event/application/controller/consumer/EventSchedulerConsumerV1Controller.java +++ b/src/main/java/com/daon/onjung/event/application/controller/consumer/EventSchedulerConsumerV1Controller.java @@ -21,7 +21,8 @@ public void execute(JobExecutionContext context) throws JobExecutionException { Long eventId = context.getJobDetail().getJobDataMap().getLong("eventId"); // eventId를 통해 ScheduledEventJob을 삭제 - scheduledEventJobRepository.deleteByEventId(eventId); + scheduledEventJobRepository.findByEventId(eventId) + .ifPresent(scheduledEventJobRepository::delete); log.info("ScheduledEventJob 삭제 완료. eventId: {}", eventId); processCompletedEventUseCase.execute(eventId);