Skip to content

Conversation

@sgh002400
Copy link
Contributor

변경사항

  • 이벤트 기반 병렬 처리로 개선
  • 스레드풀, 커넥션풀 튜닝

연관 이슈

@sgh002400 sgh002400 requested a review from Copilot May 17, 2025 06:12
@sgh002400 sgh002400 self-assigned this May 17, 2025
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Improves parallel processing by switching to an event-driven model, replaces DB-level locks with distributed locks, and tunes thread/connection pools.

  • Publishes AutoTradeEvent for asynchronous auto trading instead of in-loop calls.
  • Replaces pessimistic DB locks with AOP-based Redisson distributed locks.
  • Simplifies domain mappings for accounts/subscriptions and configures custom thread pools.

Reviewed Changes

Copilot reviewed 30 out of 30 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/main/java/com/tradin/module/users/account/implement/AccountProcessor.java Simplified account creation sequence
src/main/java/com/tradin/module/users/account/domain/Account.java Removed JPA relationships and helper methods
src/main/java/com/tradin/module/strategy/strategy/service/StrategyService.java Publishes AutoTradeEvent for async processing
src/main/java/com/tradin/common/config/AsyncConfiguration.java Defines tradeExecutor thread pool with basic settings
src/main/java/com/tradin/common/aop/DistributedLockAop.java Introduces AOP for distributed locks using Redisson
Comments suppressed due to low confidence (3)

src/main/java/com/tradin/module/users/account/domain/Account.java:40

  • All balances and helper methods were removed from Account, but BalanceProcessor.createUsdtBalance likely relies on account.addBalance(...). Ensure the new flow still sets up the bidirectional link or updates consumers of Account accordingly.
@OneToMany(mappedBy = "account", cascade = CascadeType.ALL, orphanRemoval = true) // removed

src/main/java/com/tradin/module/strategy/subscription/service/SubscriptionService.java:123

  • [nitpick] The method name validateExistPosition suggests checking existence, but it actually enforces absence of an open position. Consider renaming to validateNoExistingPosition or ensureNoOpenPosition for clarity.
private void validateExistPosition(Long accountId, CoinType coinType) {

src/main/java/com/tradin/module/users/account/implement/AccountProcessor.java:19

  • After saving the account, user.addAccount(account) is no longer called, so the in-memory Users aggregate is missing the new account. Consider re-attaching the account to the user or managing the relationship in BalanceProcessor.
Account account = accountRepository.save(Account.of(user));

@sgh002400 sgh002400 changed the base branch from dev to feat/#23-enhance-auto-trading May 17, 2025 06:24
@sgh002400 sgh002400 merged commit 472c825 into feat/#23-enhance-auto-trading May 17, 2025
1 check passed
@sgh002400 sgh002400 deleted the feat/#23-3-apply-async branch May 17, 2025 06:24
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.

[FEAT] 오토 트레이딩 성능 개선

2 participants