Skip to content

Commit e3c6562

Browse files
committed
refactor(recruit-board): 스케쥴링 작업 중 에러 발생시 로깅 처리
1 parent 93a78de commit e3c6562

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

src/main/java/com/somemore/domains/recruitboard/scheduler/RecruitBoardStatusUpdateScheduler.java

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,14 @@ public void updateRecruitBoardStatusToClosed() {
3030
LocalDateTime startOfDay = LocalDate.now().atStartOfDay();
3131
LocalDateTime startOfNextDay = LocalDate.now().plusDays(1).atStartOfDay();
3232

33-
long updatedCount = recruitBoardRepository.updateRecruitingToClosedByStartDate(startOfDay,
34-
startOfNextDay);
35-
log.info("총 {}개의 모집글 상태를 CLOSED로 변경 완료", updatedCount);
36-
33+
try {
34+
long updatedCount = recruitBoardRepository.updateRecruitingToClosedByStartDate(
35+
startOfDay, startOfNextDay);
36+
log.info("총 {}개의 모집글 상태를 CLOSED로 변경 완료", updatedCount);
37+
} catch (Exception e) {
38+
log.error("봉사 시작일에 해당하는 모집글 상태를 CLOSED로 변경하는 중 오류 발생", e);
39+
throw e;
40+
}
3741
}
3842

3943
@Retryable(
@@ -46,9 +50,13 @@ public void updateRecruitBoardStatusToCompleted() {
4650
log.info("봉사 종료일이 지난 모집글 상태를 COMPLETED로 변경하는 작업 시작");
4751
LocalDateTime now = LocalDateTime.now();
4852

49-
long updatedCount = recruitBoardRepository.updateClosedToCompletedByEndDate(now);
50-
log.info("총 {}개의 모집글 상태를 COMPLETED로 변경 완료", updatedCount);
51-
53+
try {
54+
long updatedCount = recruitBoardRepository.updateClosedToCompletedByEndDate(now);
55+
log.info("총 {}개의 모집글 상태를 COMPLETED로 변경 완료", updatedCount);
56+
} catch (Exception e) {
57+
log.error("봉사 종료일이 지난 모집글 상태를 COMPLETED로 변경하는 중 오류 발생", e);
58+
throw e;
59+
}
5260
}
5361

5462
}

0 commit comments

Comments
 (0)