-
Notifications
You must be signed in to change notification settings - Fork 1
Feature/198 모집글 스케쥴링 #205
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/198 모집글 스케쥴링 #205
Conversation
|
| schedules: | ||
| cron: | ||
| updateBoardsToClosed: "0 0 0 * * ?" # updateBoardsToClosed 스케줄링 cron 표현식 | ||
| updateBoardsToCompleted: "0 0 0 * * ?" # updateBoardsToCompleted 스케줄링 cron 표현식 | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
오 이것도 뺄수가 있군요
신기하네요
m-a-king
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
수고하셨습니다!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
00시와 24시를 나눠주는 친절한 범수 님!
이해가 잘 됐습니다.
|
|
||
| private final RecruitBoardRepository recruitBoardRepository; | ||
|
|
||
| @Scheduled(cron = "${spring.schedules.cron.updateBoardsToClosed}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| @Scheduled(cron = "${spring.schedules.cron.updateBoardsToClosed}") | |
| @Retryable( | |
| value = Exception.class, | |
| maxAttempts = 3, | |
| backoff = @Backoff(delay = 100000) // 100초 후 재시도 | |
| ) | |
| @Scheduled(cron = "${spring.schedules.cron.updateBoardsToClosed}") |
이런 재시도 로직도 가능할 것 같아요!
| List<RecruitBoard> boards = recruitBoardRepository.findByStartDateTimeBetweenAndStatus( | ||
| startOfDay, startOfNextDay, RECRUITING); | ||
|
|
||
| boards.forEach(RecruitBoard::markAsClosed); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
아니면 여기서 실패 로직이 나오면 데드 레터 큐 방식으로 레디스로 서버 이벤트를 발행하고 처리할 수 있을 것 같아요~~
| List<RecruitBoard> boards = recruitBoardRepository.findByStartDateTimeBetweenAndStatus( | ||
| startOfDay, startOfNextDay, RECRUITING); | ||
|
|
||
| boards.forEach(RecruitBoard::markAsClosed); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| boards.forEach(RecruitBoard::markAsClosed); | |
| boards.forEach(board -> { | |
| try { | |
| board.markAsClosed(); | |
| } catch (Exception e) { | |
| // event 생성 | |
| serverEventPublisher.publish(event); | |
| log.warn("보드 업데이트 실패: {} (ID: {})", e.getMessage(), board.getId()); | |
| } | |
| }); |
| private final RecruitBoardRepository recruitBoardRepository; | ||
|
|
||
| @Scheduled(cron = "${spring.schedules.cron.updateBoardsToClosed}") | ||
| public synchronized void transitionBoardsToClosed() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
synchronized 키워드는 왜 적으셨는지 궁금합니다!
테스트 코드에서 스케줄러 호출때문에 그런걸까요?




resolved :
📌 과제 설명
봉사 시작 당일 00시 모집상태는 모집 완료로 변경
봉사 종료 후 그날 24시 모집 상태는 완료로 변경
👩💻 요구 사항과 구현 내용
✅ PR 포인트 & 궁금한 점