Skip to content

refactor: 주문 처리 소규모 구조 정리#106

Merged
ohhalim merged 1 commit into
developfrom
refactor/105/order-small-structure-cleanup
May 29, 2026
Merged

refactor: 주문 처리 소규모 구조 정리#106
ohhalim merged 1 commit into
developfrom
refactor/105/order-small-structure-cleanup

Conversation

@ohhalim

@ohhalim ohhalim commented May 29, 2026

Copy link
Copy Markdown
Owner

목적

  • 주문 처리 코드의 낮은 리스크 구조 정리
  • 주문 취소 경로의 market lock 사용 방식 통일
  • 후속 지갑 주문 작업 경계 분리 전 선행 정리

배경

  • #104에서 주문 조회 책임 분리 완료
  • MatchingEngine 내부 orderbook 조회/생성 코드 반복 존재
  • 주문 생성/비동기 처리 경로는 MarketOrderLockScope 기준 사용
  • 주문 취소 경로는 ReentrantLock 직접 획득/해제 방식 사용
  • cancel 경로의 lock 사용 방식과 계측 기준 통일 필요

변경 사항

  • MatchingEngine.getOrCreateBook() helper 추가
  • planMatch, planMatchRejectingSelfTrade, applyMatchPlan, addToBook의 반복 computeIfAbsent 제거
  • MarketOrderLockService.acquire(Long marketId, String marketSymbol, OrderSide side) 추가
  • OrderCancelService의 직접 ReentrantLock 사용 제거
  • 주문 취소 경로를 MarketOrderLockScope 기준으로 통일

검증

./gradlew test

후속 작업

  • 지갑 주문 작업 경계 분리
  • order 패키지의 wallet repository 직접 접근 제거

closes #105

- MatchingEngine orderbook 조회/생성 helper 추출
- 반복 computeIfAbsent 제거
- MarketOrderLockService cancel 경로용 lock scope 추가
- OrderCancelService 직접 ReentrantLock 사용 제거
- cancel 경로 lock wait/hold 계측 기준 통일
- 검증: ./gradlew test
@coderabbitai

coderabbitai Bot commented May 29, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@ohhalim, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 37 minutes and 49 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: f3e205ca-9dab-4b01-aaf8-2d908ba9ae95

📥 Commits

Reviewing files that changed from the base of the PR and between 999372b and a49de47.

📒 Files selected for processing (3)
  • src/main/java/com/coinflow/order/matching/MatchingEngine.java
  • src/main/java/com/coinflow/order/service/cancel/OrderCancelService.java
  • src/main/java/com/coinflow/order/service/lock/MarketOrderLockService.java
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch refactor/105/order-small-structure-cleanup

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 and usage tips.

@ohhalim ohhalim merged commit a735e30 into develop May 29, 2026
2 checks 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

Development

Successfully merging this pull request may close these issues.

refactor: 주문 처리 소규모 구조 정리

1 participant