Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 새벽 4시에 약속 삭제 로직 Lazy 에러 해결 #701

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from

Conversation

hyeon0208
Copy link
Contributor

🚩 연관 이슈

close #700


📝 작업 내용

새벽 4시마다 실행되는 scheduleOverdueMeetings() 메서드도 이전 스케줄링 문제와 동일하게
OSIV false로 Lazy 문제가 발생해 트랜잭션 범위에 넣어주어 해결했습니다.

추가로 4시마다 스케줄링된다는 부분을 테스트 추가했는데
현재는 실제 실행되는 상황과 동일하게 맞춰 테스트를 하지만
실제 스케줄링된 작업에 대한 테스트를 보장하진 않기 때문에 정책이 4시가 아닌 다른 시간으로 변경되면 테스트가 애매하긴해요
하지만 실제 스케줄링된 작업을 테스트하기 위해선 특정 시간만큼 기다리는 방법밖에 없는 것 같아 이 방법으로 추가해봤습니다


🏞️ 스크린샷 (선택)


🗣️ 리뷰 요구사항 (선택)

Copy link

Test Results

158 tests  +1   158 ✅ +1   5s ⏱️ ±0s
 45 suites ±0     0 💤 ±0 
 45 files   ±0     0 ❌ ±0 

Results for commit 31c5426. ± Comparison against base commit 75475eb.

This pull request removes 6 and adds 7 tests. Note that renamed tests count towards both.
com.ody.auth.JwtTokenProviderTest$validateAccessToken ‑ [1] accessToken=com.ody.auth.token.AccessToken@dd104a9
com.ody.auth.JwtTokenProviderTest$validateAccessToken ‑ [2] accessToken=com.ody.auth.token.AccessToken@6ba8a9d5
com.ody.common.validator.FutureOrPresentDateTimeValidatorTest ‑ [1] date=2024-10-11, time=08:29:51.001866057, expected=false
com.ody.common.validator.FutureOrPresentDateTimeValidatorTest ‑ [2] date=2024-10-11, time=09:29:51.001879642, expected=true
com.ody.common.validator.FutureOrPresentDateTimeValidatorTest ‑ [3] date=2024-10-11, time=07:29:51.001871307, expected=false
com.ody.common.validator.FutureOrPresentDateTimeValidatorTest ‑ [4] date=2024-10-12, time=08:29:51.001866057, expected=true
com.ody.auth.JwtTokenProviderTest$validateAccessToken ‑ [1] accessToken=com.ody.auth.token.AccessToken@59224736
com.ody.auth.JwtTokenProviderTest$validateAccessToken ‑ [2] accessToken=com.ody.auth.token.AccessToken@6fedd7e2
com.ody.common.validator.FutureOrPresentDateTimeValidatorTest ‑ [1] date=2024-10-11, time=10:48:39.439293695, expected=false
com.ody.common.validator.FutureOrPresentDateTimeValidatorTest ‑ [2] date=2024-10-11, time=11:48:39.439314734, expected=true
com.ody.common.validator.FutureOrPresentDateTimeValidatorTest ‑ [3] date=2024-10-11, time=09:48:39.439303433, expected=false
com.ody.common.validator.FutureOrPresentDateTimeValidatorTest ‑ [4] date=2024-10-12, time=10:48:39.439293695, expected=true
com.ody.meeting.service.MeetingServiceTest ‑ 오전 4시 마다 약속 시간이 지난 약속들의 상태를 기간 지남으로 변경하고 구독한 topic을 취소한다.

Copy link

📝 Test Coverage Report

Overall Project 80.25% 🍏
Files changed 100% 🍏

File Coverage
MeetingService.java 93.91% 🍏

Copy link
Contributor

@coli-geonwoo coli-geonwoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

카키! OSIV 문제를 빠르게 처리해주셨네요! 늘 감사합니다 🙇

test 관련해서 한가지 이해되지 않는 부분이 있어서 질문 남겼으니 확인부탁드립니다.


assertAll(
() -> assertThat(LocalDateTime.of(2024, 10, 10, 3, 59, 59)).isNotEqualTo(nextExecutionTime),
() -> assertThat(LocalDateTime.of(2024, 10, 10, 4, 0, 1)).isNotEqualTo(nextExecutionTime),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

카키! CronExpression에 익숙치 않아 몇가지 질문 남깁니다.
expression next는 다음에 작업이 실행될 시간을 반환하는 것으로 알고 있어서 2024-10-10-4시가 nextExecutionTime에 저장되는 것으로 이해했어요.

  • 그렇다면 nextExecution을 위에는 isNotEqualTo로 검증하고 밑에는 isEqualTo로 검증하는 이유가 궁금합니다 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

fix: 새벽 4시에 약속 삭제 로직 Lazy 에러 해결
2 participants