Transactional로 인한 비정상적이던 task 실행 수정 및 retry 적용#185
Merged
Conversation
# Please enter a commit message to explain why this merge is necessary, # especially if it merges an updated upstream into a topic branch. # # Lines starting with '#' will be ignored, and an empty message aborts # the commit.
# Conflicts: # apps/user-service/src/main/java/site/icebang/domain/workflow/model/Task.java # apps/user-service/src/main/java/site/icebang/domain/workflow/service/WorkflowExecutionService.java
…로 인한 비정상적인던 task 실행 동작 수정
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.
📝 작업 내용
Task 실행 안정성 강화 (트랜잭션 롤백 방지)
@Transactional메소드 내에서 Task 실행 중 예외가 발생하면, 트랜잭션 전체가 롤백되어workflow_run,job_run,task_run의 상태가FAILED로 기록되지 않는 문제가 있었습니다.executeTasksForJob메소드 내부에try-catch블록을 추가하여, Task 실행 중 발생하는 모든 예외를 처리합니다. 이를 통해 예외가 발생하더라도 트랜잭션이 롤백되지 않고, 모든 실행 이력과 최종FAILED상태가 DB에 정상적으로 커밋(Commit)되도록 수정했습니다.Spring Retry를 이용한 재시도 정책 적용
TaskExecutionService를 신규 생성하여, Task 실행 로직을 위임하고 재시도 책임을 분리했습니다.@Retryable어노테이션을 사용하여 외부 API 통신 실패(RestClientException) 시 최대 3회, 5초 간격으로 재시도하도록 설정했습니다.@Recover어노테이션을 사용하여 모든 재시도가 실패했을 때 최종 실패를 처리하는 복구 로직을 구현했습니다.디렉토리 구조 리팩토링
execution도메인을workflow도메인에 합침 **: 응집도(Cohesion)를 높이기 위한 리팩토링🔗 관련 이슈
💬 추가 요청사항
✅ 체크리스트
코드 품질
테스트
배포 준비