[Refactor] External Api Isolation in 방 생성#350
Open
seongjunnoh wants to merge 14 commits intodevelopfrom
Open
Conversation
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.
#️⃣ 연관된 이슈
📝 작업 내용
외부 API(Naver, Aladin) 지연이 내부 시스템 자원(DB 커넥션, 톰캣 쓰레드) 고갈로 이어지는 연쇄 장애(Cascading Failure)를 차단하고, 방 생성 도메인의 가용성을 확보하기 위해 아키텍처를 개선했습니다.
트랜잭션 경계 분리 및 타임아웃 적용
@Transactional을 제거하고TransactionTemplate을 도입하여 외부 API 호출 구간을 DB 트랜잭션 밖으로 분리RestTemplate및WebClient에 명시적 Timeout(Connect 3s, Read 5s) 설정도메인 특성을 반영한 장애 격리 (Fault Isolation)
pageCount = null로 격리하여 방 생성 속행(Fail-soft)subscribe()) 알림 전송최종적 일관성(Eventual Consistency) 보장
BookPageCountFillScheduler도입으로 누락된pageCount복구 (외부 API 쓰로틀링 적용)ISBN_NOT_FOUND)는pageCountUnfindable = true플래그로 업데이트하여 무의미한 API 반복 호출(좀비 프로세스) 영구 차단동시성 예외 제어
DataIntegrityViolationException예외를 캐치하여 기존 데이터 재조회로 처리📸 스크린샷
💬 리뷰 요구사항
TransactionTemplate내부로 묶인 DB 쓰기 작업의 트랜잭션 경계가 적절히 최소화되었는지 검토 바랍니다.📌 PR 진행 시 이러한 점들을 참고해 주세요
Summary by CodeRabbit
릴리스 노트
새로운 기능
버그 수정