Skip to content

refactor: 스케줄러 책임 분리 및 알림 발송 재시도 로직 추가#77

Merged
Woomin-Wang merged 4 commits into
mainfrom
refactor/scheduler-question
May 9, 2026
Merged

refactor: 스케줄러 책임 분리 및 알림 발송 재시도 로직 추가#77
Woomin-Wang merged 4 commits into
mainfrom
refactor/scheduler-question

Conversation

@Woomin-Wang
Copy link
Copy Markdown
Contributor

@Woomin-Wang Woomin-Wang commented May 9, 2026

📌 관련 이슈 (Related Issue)

📝 작업 내용 (Description)

  • DailyQuestionGenerationServiceTodayQuestionService로 클래스·메서드·필드명 정비
  • 알림 발송 로직을 QuestionNotificationService로 분리
  • @Scheduled에 zone = "Asia/Seoul" 추가 (timezone 버그 수정)
  • 스케줄러 전체 실패 시 catch 추가 및 소요시간(elapsed) 로그 개선
  • spring-retry 도입, 이메일/카카오 발송 실패 시 최대 3회 지수 백오프 재시도 적용

🔄 변경 유형 (Type of Change)

  • ✨ 새로운 기능 (feat)
  • 🐛 버그 수정 (fix)
  • 📝 문서 수정 (docs)
  • 💄 스타일 (style)
  • ♻️ 리팩토링 (refactor)
  • ✅ 테스트 (test)
  • 🔧 기타 (chore)

✅ 체크리스트 (Checklist)

  • 코드가 정상적으로 동작하는지 확인했습니다
  • 기존 테스트가 통과합니다
  • 필요한 경우 새로운 테스트를 추가했습니다

💬 추가 코멘트 (Additional Comments)

  • @retryableEmailService, KakaoService에 적용했습니다.
  • QuestionNotificationService의 내부 private 메서드에는 AOP 프록시가 적용되지 않아 각 서비스 클래스에 직접 붙였습니다.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a retry mechanism for email and Kakao notifications using Spring Retry and refactors the notification logic into a dedicated QuestionNotificationService. It also renames the daily question service to TodayQuestionService and enhances the scheduler with explicit time zone settings and execution time logging. Feedback was provided regarding the retrieval of a member's previous questions in TodayQuestionService, suggesting that the query should be limited to recent records to prevent performance degradation as the database grows.

private void processTodayQuestion(MemberSchedulerInfo member) {
private void generateAndSend(MemberSchedulerInfo member) {
try {
List<InterviewQuestion> previousQuestions = questionRepository.findByMemberId(member.id());
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

questionRepository.findByMemberId(member.id())는 해당 회원의 모든 과거 질문 데이터를 조회합니다. 서비스 사용 기간이 길어짐에 따라 조회되는 데이터 양이 많아지면 성능 저하와 메모리 부하를 초래할 수 있습니다. 프롬프트 생성에 필요한 최근 질문들만 조회하도록 제한(예: findTop10ByMemberIdOrderByCreatedAtDesc)하는 로직으로 개선이 필요합니다.

@Woomin-Wang Woomin-Wang merged commit 8dd4103 into main May 9, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: 알림 발송 재시도 로직 추가

1 participant