Open
Conversation
- 메인 API 응답 지연 방지를 위해 요약 큐 적재 로직을 @async로 비동기화함. - 기존 while/sleep 기반의 수동 재시도 로직을 Spring @retryable 어노테이션으로 대체하여 코드 가독성 및 유지보수성을 향상함. - 재시도 최대 횟수(3회) 초과 시 대체 흐름 처리를 위해 @recover 로직을 추가함. - AsyncConfig 설정에 @EnableAsync, @EnableRetry 활성화 애노테이션을 추가함.
📊 코드 커버리지 리포트
|
5a01bd7 to
de98703
Compare
- SummaryWorker 내 @transactional 내부 호출(Self-Invocation)로 인한 프록시 우회 및 롤백 불가 버그를 수정함. - SummaryWorker에 집중되어 있던 인프라 로직과 비즈니스 로직을 분리하여 단일 책임 원칙(SRP)을 준수함. - 로직을 순수 DB/비즈니스 처리를 담당하는 SummaryService와 외부 AI 서버 통신을 전담하는 SummaryClient로 분리함 - 오래 걸리는 외부 AI API 호출 구간을 DB 트랜잭션 범위 밖으로 분리하여 DB 커넥션 풀 고갈 위험을 완벽히 제거함.
de98703 to
0880395
Compare
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.
관련 이슈
PR 설명
SummaryWorker에 집중되어 있던 책임을 분리하여 트랜잭션 프록시 내부 호출 버그를 해결하고 DB 커넥션 점유 시간을 최적화함.작업 내용
비즈니스 로직 및 인프라
LinkEventListener에@Async를 적용하여 요약 큐 적재 작업을 백그라운드 스레드로 완전히 분리함.while및sleep기반의 재시도 로직을@Retryable(최대 3회, 100ms 대기)로 깔끔하게 리팩토링함.@Recover복구 메서드를 구현함.AsyncConfig설정 클래스 신설함.SummaryWorker의 로직을 인프라(SummaryWorker), 비즈니스/DB(SummaryService), 외부 API 통신(AiSummaryClient)으로 완벽히 분리함.SummaryWorker내@Transactional메서드 내부 호출(Self-Invocation) 버그를 수정하여 롤백 안정성을 확보함.테스트
LinkEventListenerTest@EnableRetry,@EnableAspectJAutoProxy)을 명시적으로 구성하여 Spring Retry 동작 검증함.@Recover복구 로직 정상 작동 확인함.SummaryWorkerTestLinkFacadeTest