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

[WHD-290] Fix: Order update with pessimistic lock #61

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

jjunhub
Copy link
Member

@jjunhub jjunhub commented Dec 2, 2024

기능 설명

주문 상태 변경 시, 비관적 락 이용하도록 변경

작성 상세 내용

  • 클라이언트 측 결제 완료와 포트원 측 Webhook이 동시에 접근하여 Race Condition이 발생
  • 이를 비관적 락을 통해 먼저 접근한 쓰레드가 상태를 변경할 때까지 대기하도록 변경하여 데이터 무결성 보장

관련 지라 티켓 번호

WHD-290

참고 자료

@jjunhub jjunhub requested a review from juy4844 December 2, 2024 16:41
Copy link

github-actions bot commented Dec 2, 2024

Test Coverage Report

Overall Project 70.62% 🍏
Files changed 100% 🍏

File Coverage
OrderService.java 73.15% 🍏
OrderRepositoryImpl.java 72.97% 🍏


public interface OrderJpaRepository extends JpaRepository<Order, Long> {
boolean existsByOrderMerchantUid(String orderMerchantUid);

Optional<Order> findByOrderMerchantUid(String orderMerchantUid);

@Lock(LockModeType.PESSIMISTIC_WRITE)
Copy link
Contributor

Choose a reason for hiding this comment

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

락을 응용하여 잘 쓰신거 같습니다.

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

Successfully merging this pull request may close these issues.

2 participants