From 9bd1060c53232af18c978a5d4e7947d0f4a4ab4a Mon Sep 17 00:00:00 2001 From: j-yong99 Date: Mon, 27 May 2024 16:57:12 +0900 Subject: [PATCH] =?UTF-8?q?:sparkles:=20=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../config/SchedulerConfiguration.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/backend/moment/moment-server/scheduler/src/main/java/com/moment/scheduler/config/SchedulerConfiguration.java b/backend/moment/moment-server/scheduler/src/main/java/com/moment/scheduler/config/SchedulerConfiguration.java index 4a039302de..1315f0596c 100644 --- a/backend/moment/moment-server/scheduler/src/main/java/com/moment/scheduler/config/SchedulerConfiguration.java +++ b/backend/moment/moment-server/scheduler/src/main/java/com/moment/scheduler/config/SchedulerConfiguration.java @@ -1,6 +1,8 @@ package com.moment.scheduler.config; +import com.moment.scheduler.domain.cardView.CardViewRepository; import com.moment.scheduler.domain.user.UserRepository; +import com.moment.scheduler.service.CardViewService; import com.moment.scheduler.service.NotiService; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; @@ -16,6 +18,8 @@ public class SchedulerConfiguration { private final NotiService notiService; private final UserRepository userRepository; + private final CardViewService cardViewService; + private final CardViewRepository cardViewRepository; // 매일 오후 1시에 알림 발송 @Scheduled(cron = "0 0 14 * * *") @@ -30,4 +34,19 @@ public void run() { log.error("Failed to send notification"); } } + + // 매 한시간마다 분석요청 + @Scheduled(cron = "0 0 * * * *") + public void run2() { + log.info("Analysis Scheduler is running"); + try { + // 만약 분석중인 카드뷰가 하나라도 있는 경우 + if (!cardViewRepository.findAllByRecordFileStatusIn(List.of("WAIT")).isEmpty()) { + cardViewService.getIncompleteCardViews(); + } + + } catch (Exception e) { + log.error("Failed to send notification"); + } + } } \ No newline at end of file