Kế hoạch: Matching & Matchmaking Feature
1. Hiện trạng
MatchMatchingCmdConsumer: support cảprize_idvàprize_ids(multi-match).OpponentPoolCmdHandler: join/leave/query pool.InvitationCmdConsumer: full invitation lifecycle.- Batch:
MatchMakingForAllGameModeConfigscheduler,DeleteExpiredInvitationConfigcleanup.
2. Kế hoạch cải tiến
Phase 1: Validation & error standardization
- Task 1-1: Chuẩn hóa error events cho matching/pool/invitation
- Task 1-2: Test leave queue khi không có record (graceful)
Phase 2: Performance
- Task 2-1: Tune matchmaking scheduler interval
- Task 2-2: Monitor queue depth: prize-allocation và invitation queues
- Task 2-3: Metrics: match success rate, average wait time
Phase 3: Testing
- Task 3-1: Single prize flow end-to-end
- Task 3-2: Multi-match prizeIds flow
- Task 3-3: Invitation lifecycle test
3. Rủi ro
| Rủi ro | Ảnh hưởng | Biện pháp |
|---|---|---|
| Inconsistent prizeIds không bị catch | Sai queue routing | Validate trước enqueue |
| Matchmaking scheduler overlap | Double match | fixedDelay thay vì fixedRate |
| Invitation TTL quá ngắn | UX xấu | Config TTL + monitor expiry rate |
| Leave graceful missing case | User stuck | Thêm test coverage |