Skip to content

Commit

Permalink
풀 리퀘스트 병합 #177
Browse files Browse the repository at this point in the history
backend/develop/v3
  • Loading branch information
J-Yong99 authored May 27, 2024
2 parents 6b8efc1 + 9bd1060 commit 92a032d
Showing 1 changed file with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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 * * *")
Expand All @@ -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");
}
}
}

0 comments on commit 92a032d

Please sign in to comment.