[HSC-424] user-log admin dispatch 아웃박스 적재 경량화 및 재시도 완화#281
Merged
Conversation
There was a problem hiding this comment.
Code Review
이 풀 리퀘스트는 사용자 로그 아웃박스 처리를 위한 배치 저장 기능을 도입하고 관련 스케줄러 설정을 최적화합니다. 코드 리뷰 결과, enqueueBatch 메서드에서 saveAll 호출 중 예외 발생 시 트랜잭션이 롤백 전용으로 마킹되어 catch 블록 내의 개별 저장 시도가 실패할 수 있는 심각한 로직 오류가 확인되었습니다. 또한, isAdminTarget 판별 로직과 decodeTsidToLong 유틸리티 메서드가 여러 클래스에 중복 정의되어 있으므로, 이를 shared 모듈로 이동하여 프로젝트 아키텍처 가이드를 준수하고 유지보수성을 높여야 합니다.
🧪 Test Coverage Report (JaCoCo)
Package line spark (sample): 📦 Package coverage (worst 10)
🧨 Lowest coverage classes (worst 10)
🧩 Changed files coverage breakdown (3 files)
🔎 HTML 리포트: Actions → Artifacts → |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📝작업 내용
outbox 도입 이후 Burst 구간에서 customer ingress가 먼저 503을 반환하던 문제에 대한 hot path 경량화와 retry scheduler 완화.
문제 상황
기존 outbox 구현에서는 request path에서 admin 대상 이벤트를 한 건씩 저장했고, retry scheduler도 짧은 주기와 큰 batch로 DB를 동시에 두드리고 있었다. 그 결과 Burst 구간에서
/api/v1/customer/user-logsingress 자체가 503을 반환하기 시작했다.해결 과정
publishBatch()에서 outbox 적재를 일괄 처리로 전환saveAndFlush()대신save()로 유지변경 요약
publishBatch()일괄 적재 전환구조도
flowchart LR A["publishBatch()"] --> B["Kafka publish 반복"] A --> C["Outbox batch enqueue"] D["Scheduler"] --> E["소량 batch claim"] E --> F["dispatch retry"] style C fill:#eef8ef,stroke:#5a9c67 style D fill:#eef4ff,stroke:#5b80b7👀변경 사항
구현 항목
src/main/java/site/holliverse/customer/application/usecase/log/UserLogAdminDispatchOutboxService.javaenqueueBatch()추가,saveAll()기반 적재src/main/java/site/holliverse/customer/application/usecase/log/UserLogService.javapublishBatch()에서 일괄 outbox 적재 사용src/main/java/site/holliverse/customer/application/usecase/log/UserLogAdminDispatchScheduler.javasrc/main/resources/application-customer.yml변경 전/후
커밋 단위
[HSC-424] perf: 사용자 로그 아웃박스 배치 적재 적용publishBatch()연동[HSC-424] perf: 사용자 로그 dispatch 재시도 기본값 완화확인 메모
🎫 Jira Ticket
#️⃣관련 이슈