Skip to content

fix: 스케줄러 타임존 불일치 및 LazyInitializationException 수정#252

Merged
dongmin0204 merged 1 commit into
developfrom
fix/h6-h7-scheduler-timezone-transaction
Jul 6, 2026
Merged

fix: 스케줄러 타임존 불일치 및 LazyInitializationException 수정#252
dongmin0204 merged 1 commit into
developfrom
fix/h6-h7-scheduler-timezone-transaction

Conversation

@yoon6yo

@yoon6yo yoon6yo commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

관련 이슈

변경 사항

[H-6] LocalDateTime.now() 타임존 수정

UTC 컨테이너 환경에서 cron의 KST 시간대와 최대 9시간 오차가 발생하던 문제를 수정합니다.

// Before
LocalDateTime now = LocalDateTime.now();  // UTC 기준

// After
LocalDateTime now = LocalDateTime.now(ZoneId.of("Asia/Seoul"));  // KST 기준

RequestSchedulerService, UserSchedulerService 양쪽 모두 적용합니다.

[H-7] UserLifecycleTransactionalService 도입

processInactiveUsers()에서 user.getRequests()를 트랜잭션 없이 접근하여 LazyInitializationException이 발생하던 문제를 해결합니다.

  • UserLifecycleTransactionalService 신규 생성: 유저별 독립 @Transactional 메서드 제공
  • UserSchedulerService는 조회만 하고, 실제 처리는 UserLifecycleTransactionalService에 위임
  • 유저별 독립 트랜잭션으로 H-11(processHardDeleteUsers 실패 시 rollback 전파)도 예방

테스트

  • 기존 테스트 전체 통과 (./gradlew test)
  • RequestSchedulerServiceTest: LocalDateTime.now(ZoneId) 정적 목 추가

🤖 Generated with Claude Code

- [H-6] LocalDateTime.now() → LocalDateTime.now(ZoneId.of("Asia/Seoul"))로 수정
  (RequestSchedulerService, UserSchedulerService 모두 적용)
  UTC 컨테이너 환경에서 KST cron과 최대 9시간 오차 발생하던 버그 해결
- [H-7] UserLifecycleTransactionalService 신규 도입
  processInactiveUsers()에서 user.getRequests() 접근 시 트랜잭션 없어
  LazyInitializationException 발생하던 문제를 유저별 독립 @transactional로 해결
  동시에 H-11 위험(단일 트랜잭션 롤백 전파)도 예방
- 테스트 코드: LocalDateTime.now(ZoneId) 정적 목 추가

Closes #246, #247

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 5, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 1de1f5c6-5ace-4753-abc2-2d8ff75b4800

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/h6-h7-scheduler-timezone-transaction

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@dongmin0204 dongmin0204 merged commit d9de993 into develop Jul 6, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants