Skip to content

[REFACTOR/#280] 사용 가능한 제휴 조회, 알림 재전송 로직 수정#281

Merged
leesumin0526 merged 3 commits intodevelopfrom
refactor/#280-student-usable
Mar 3, 2026
Merged

[REFACTOR/#280] 사용 가능한 제휴 조회, 알림 재전송 로직 수정#281
leesumin0526 merged 3 commits intodevelopfrom
refactor/#280-student-usable

Conversation

@leesumin0526
Copy link
Contributor

@leesumin0526 leesumin0526 commented Mar 3, 2026

#️⃣연관된 이슈

#280

📝작업 내용

  • UserPaper 동기화 로직 수정
    Paper 당 하나의 Paper Content만 들고 오던 기존 로직에서 모든 Paper Content를 들고 올 수 있도록 수정
  • UserPaper 조회 로직 N+1 문제 해결
  • 알림 재시도 시스템을 스케줄러 기반에서 이벤트 처리 기반으로 전환

🔎코드 설명(스크린샷(선택))

스크린샷 2026-03-03 오후 3 43 11 서버 재시작 또는 Pending 상태인 알림 발생시 재전송 최대 3번 진행

  - syncUserPapersForStudent: 반복 exists 쿼리를 일괄 조회 후 메모리 필터링으로 변경
  - getUsablePartnership: Goods 조회를 batch 처리로 최적화
  - UserPaperRepository.findByStudentId, GoodsRepository.findByContentIdIn 추가
  - saveAll로 bulk insert 적용
 - 기존 30초 주기 스케줄러를 이벤트 기반 처리로 변경하여 서버 부하 개선
 - 알림 전송 실패 시 즉시 재시도 이벤트 발행 (exponential backoff 적용)
 - 서버 재시작 시 미처리 PENDING 알림 자동 복구 처리
 - 영구 실패(FCM UNREGISTERED 등)와 일시적 실패 구분하여 재시도

Changes:
 - Add: NotificationFailedEvent, NotificationRetryEventHandler
 - Modify: OutboxRetryScheduler (스케줄러 비활성화, 시작시에만 복구)
 - Modify: NotificationListener, OutboxAfterCommitPublisher (실패시 이벤트 발행)
 - Modify: OutboxRetryProcessor (재시도 실패시 이벤트 발행)
 - 기존 30초 주기 스케줄러를 이벤트 기반 처리로 변경하여 서버 부하 개선
 - 알림 전송 실패 시 즉시 재시도 이벤트 발행 (exponential backoff 적용)
 - 서버 재시작 시 미처리 PENDING 알림 자동 복구 처리
 - 영구 실패(FCM UNREGISTERED 등)와 일시적 실패 구분하여 재시도

Changes:
 - Add: NotificationFailedEvent, NotificationRetryEventHandler
 - Modify: OutboxRetryScheduler (스케줄러 비활성화, 시작시에만 복구)
 - Modify: NotificationListener, OutboxAfterCommitPublisher (실패시 이벤트 발행)
 - Modify: OutboxRetryProcessor (재시도 실패시 이벤트 발행)
@leesumin0526 leesumin0526 self-assigned this Mar 3, 2026
@leesumin0526 leesumin0526 added the ♻️ refactor Refactor code label Mar 3, 2026
@leesumin0526 leesumin0526 merged commit e916db1 into develop Mar 3, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

♻️ refactor Refactor code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant