링크 저장 시 AI 요약 생성 비동기 처리 리팩토링 및 Worker 책임 분리#181
Merged
ckdals4600 merged 3 commits intomainfrom Mar 7, 2026
Merged
Conversation
📊 코드 커버리지 리포트
|
0880395 to
7f5f442
Compare
Contributor
|
@ckdals4600 의견 부탁드립니다. 현재 비동기 요약 생성이 도는 동안 “재요약 API 호출”을 막으려면, 결국 ‘요약 진행 중’이라는 상태를 판단할 수 있어야 하는데요. 그래서 요약 상태(예: PENDING/READY/FAILED)를 Link나 Summary에 추가해
같은 정책을 명확히 두는 게 필요해 보입니다. 이 방향에 대해 어떻게 생각하시나요? |
Contributor
Author
요약 상태의 작업의 경우 #188 에서 진행중에 있습니다.
같은 정책은 작업이 되지 않아서 해당 이슈에서 추가 작업을 진행하도록 하겠습니다 |
Goder-0
approved these changes
Mar 6, 2026
- 메인 API 응답 지연 방지를 위해 요약 큐 적재 로직을 @async로 비동기화함. - 기존 while/sleep 기반의 수동 재시도 로직을 Spring @retryable 어노테이션으로 대체하여 코드 가독성 및 유지보수성을 향상함. - 재시도 최대 횟수(3회) 초과 시 대체 흐름 처리를 위해 @recover 로직을 추가함. - AsyncConfig 설정에 @EnableAsync, @EnableRetry 활성화 애노테이션을 추가함.
7f5f442 to
d088d40
Compare
- SummaryWorker 내 @transactional 내부 호출(Self-Invocation)로 인한 프록시 우회 및 롤백 불가 버그를 수정함. - SummaryWorker에 집중되어 있던 인프라 로직과 비즈니스 로직을 분리하여 단일 책임 원칙(SRP)을 준수함. - 로직을 순수 DB/비즈니스 처리를 담당하는 SummaryService와 외부 AI 서버 통신을 전담하는 SummaryClient로 분리함 - 오래 걸리는 외부 AI API 호출 구간을 DB 트랜잭션 범위 밖으로 분리하여 DB 커넥션 풀 고갈 위험을 완벽히 제거함.
d088d40 to
6a0b778
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