Skip to content

Conversation

@leebs0521
Copy link
Collaborator

resolved :

📌 과제 설명

봉사 시작 당일 00시 모집상태는 모집 완료로 변경
봉사 종료 후 그날 24시 모집 상태는 완료로 변경

👩‍💻 요구 사항과 구현 내용

✅ PR 포인트 & 궁금한 점

@leebs0521 leebs0521 self-assigned this Dec 8, 2024
@leebs0521 leebs0521 linked an issue Dec 8, 2024 that may be closed by this pull request
4 tasks
@sonarqubecloud
Copy link

sonarqubecloud bot commented Dec 8, 2024

Quality Gate Failed Quality Gate failed

Failed conditions
B Reliability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

Comment on lines +71 to +75
schedules:
cron:
updateBoardsToClosed: "0 0 0 * * ?" # updateBoardsToClosed 스케줄링 cron 표현식
updateBoardsToCompleted: "0 0 0 * * ?" # updateBoardsToCompleted 스케줄링 cron 표현식

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

오 이것도 뺄수가 있군요
신기하네요

Copy link
Collaborator

@m-a-king m-a-king left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

수고하셨습니다!

Copy link
Collaborator

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}")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
@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);
Copy link
Collaborator

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);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

synchronized 키워드는 왜 적으셨는지 궁금합니다!
테스트 코드에서 스케줄러 호출때문에 그런걸까요?

@leebs0521 leebs0521 closed this Dec 17, 2024
@leebs0521 leebs0521 deleted the feature/198-add-recruit-board-scheduling branch January 13, 2025 03:42
@leebs0521 leebs0521 removed a link to an issue Jan 13, 2025
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants