rwadurian/backend/services/mining-service/src/infrastructure
hailin 9deffe2565 fix(mining): resolve transaction timeout by using single transaction for system accounts
Problem:
- Multiple concurrent transactions updating system_mining_accounts caused row lock contention
- 16+ transactions waiting for tuple/transactionid locks led to timeout errors
- This prevented writeMinuteRecords() from executing, leaving mining_records empty

Solution:
- Modified SystemMiningAccountRepository.mine() to accept optional external transaction client
- Created new distributeToSystemAndPending() method that processes all system accounts
  and pending contributions in a single transaction
- Pre-calculate all rewards before transaction, then execute updates sequentially
- Aggregate all pending contribution rewards into single HEADQUARTERS update
- Move Redis accumulation outside transaction to avoid blocking

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-16 18:53:53 -08:00
..
kafka feat(2.0-services): 为auth/mining/trading服务添加Outbox事件发布机制 2026-01-10 20:54:37 -08:00
persistence fix(mining): resolve transaction timeout by using single transaction for system accounts 2026-01-16 18:53:53 -08:00
redis fix(mining-service): Redis锁使用毫秒PX代替秒EX支持小数TTL 2026-01-14 03:52:22 -08:00
infrastructure.module.ts fix(mining): remove duplicate burn mechanism from mining-service 2026-01-16 07:31:13 -08:00