Repository navigation
[feat] PB-79 이메일 인증 비동기 발송 및 재시도 로직 구현 - #170
Conversation
- threaddump 추가
- Spring Retry 라이브러리 추가 (지수 백오프) - emailTaskExecutor 전용 스레드풀 생성 (core:3, max:6) - @async + @retryable로 비동기 발송 (최대 3회 재시도) - @recover로 최종 실패 처리 - 회원가입 API 응답 속도 개선
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the
✨ Finishing touches🧪 Generate unit tests (beta)
Important Action Needed: IP Allowlist UpdateIf your organization protects your Git platform with IP whitelisting, please add the new CodeRabbit IP address to your allowlist:
Failure to add the new IP will result in interrupted reviews. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Why: - 회원가입 후 이메일 미수신 시 사용자가 직접 재전송 요청 가능 - 비동기 이메일 발송으로 인한 사용자 혼란 방지 What: - ResendEmailButton: 재전송 버튼 (3분 쿨다운 타이머) - SignupEmailSentView: 이메일 발송 안내 화면 - AuthView: 회원가입 성공 시 안내 화면 표시 - auth.ts: resendVerification API 추가 How: - localStorage 기반 쿨다운 상태 유지 (페이지 새로고침 대응) - fetch API로 POST /api/auth/resend-verification 호출 - 에러 처리 (쿨다운 위반, 네트워크 오류) - 접근성 지원 (aria-label, aria-busy, role="alert")
- Spring AOP 프록시 우회 문제 해결을 위해 @Async/@retryable 로직을 별도 서비스로 분리 - AsyncEmailService: 이메일 비동기 발송 및 SMTP 장애 시 자동 재시도 담당 (5초→10초→20초) - resendVerification 버그 수정: rawToken 대신 verificationLink 전달 - EmailSender, fromAddress 불필요한 의존성 제거"
- 최초 1회 + 재시도 3회 = 총 4회로 수정
PHJ2000
left a comment
There was a problem hiding this comment.
수고하셨습니다. 몇 가지 사항만 고치면 될 거 같습니다.
- spring-boot-starter-aop 추가
- @async 직접 호출 시 커밋 전 발송 가능한 정합성 문제 해결 - @TransactionalEventListener(AFTER_COMMIT) 패턴 적용 - EmailVerificationEvent (record), EmailEventListener 신규 구현 - EmailVerificationService: asyncEmailService 직접 호출 → eventPublisher로 변경
✨ Feature PR
🔗 이슈 링크 (필수)
🧩 이 PR의 변경사항 (필수)
전체 중 위치 (Stacked PR 시)
이 PR에서 변경한 것
백엔드:
AsyncEmailService신규 생성: 이메일 비동기 발송 및 재시도 로직 담당EmailVerificationService에서@Async/@Retryable로직 분리@Retryable설정: maxAttempts=4, 재시도 간격 5초→10초→20초@Recover메서드 구현: 3회 재시도 실패 시 ERROR 로그 기록프론트엔드:
ResendEmailButton컴포넌트 신규 생성SignupEmailSentView컴포넌트 신규 생성AuthView수정: 회원가입 성공 시 SignupEmailSentView 표시auth.tsAPI 추가:resendVerification()(POST /api/auth/resend-verification)✅ 이 PR이 커버하는 AC (필수)
Covers (이 PR에서 완료)
Not covered (후속 작업)
🧪 테스트 결과 (필수)
로컬
CI
수동 테스트
AC1: 회원가입 API 응답 시간 1초 이내
시나리오:
POST /api/auth/signup)결과:
전
AC2: 이메일 발송 실패 시 재시도 간격 (5초→10초→20초)
시나리오:
결과:
AC3: 재시도 3회 실패 시 @recover 로그 기록
시나리오:
결과:
AC4: 비동기 발송 중에도 201 반환
시나리오:
결과:
🧭 영향 범위 체크 (필수)
💬 리뷰 포인트 (필수)
집중해서 볼 파일/라인:
백엔드:
AsyncEmailService.java:54-59- @retryable 설정 (maxAttempts=4의 의미)AsyncEmailService.java:78-83- @recover 메서드 시그니처EmailVerificationService.java:32,67,115- AsyncEmailService 주입 및 호출프론트엔드:
ResendEmailButton.tsx:24-33- localStorage 기반 쿨다운 복원 로직ResendEmailButton.tsx:40-64- 에러 처리 (쿨다운 위반, 네트워크 오류)AuthView.tsx:189-199- 조건부 렌더링 (showEmailSent)auth.ts:121-128- resendVerification API트레이드오프/대안:
백엔드:
프론트엔드: