Kế hoạch: Livestream Feature
1. Hiện trạng
viewer-get-livestream/{id}đã tối ưu với async ban check + cached credentials.- Gift aggregation pipeline hoàn chỉnh: Redis →
GiftAggregationJob→ ActiveMQ → JMS listener → Firebase. - 4 Firebase listeners trong module
firebaselistener. - Room sync v1 (Firebase command) và v2 (direct handler).
2. Vấn đề đã biết
| # | Vấn đề | Mức độ |
|---|---|---|
| 1 | LOGGER.error dùng cho debug logs trong viewer-get-livestream |
Low (cosmetic nhưng gây noise trong logs) |
| 2 | Room sync v1 còn tồn tại song song với v2 | Medium |
| 3 | Gift aggregation interval chưa tuned | Low |
| 4 | Firebase listener health monitoring | Medium |
3. Kế hoạch cải tiến
Phase 1: Log cleanup
- Task 1-1: Đổi
LOGGER.error→LOGGER.debugcho performance logs trongviewer-get-livestream
Phase 2: Deprecation
- Task 2-1: Document và deprecate room sync v1 endpoint (
/room-sync-register) - Task 2-2: Migrate clients sang v2 (
/sync-register)
Phase 3: Performance tuning
- Task 3-1: Benchmark
viewer-get-livestreamvới concurrent requests - Task 3-2: Tune
GiftAggregationJobfixedDelay theo traffic analysis
Phase 4: Observability
- Task 4-1: Firebase listener health check (listener alive? processing lag?)
- Task 4-2: Gift aggregation metrics (batch size, processing time)
4. Rủi ro
| Rủi ro | Ảnh hưởng | Biện pháp |
|---|---|---|
| Firebase listener crash | Events không được process | JMSListenerRecoveryScheduler pattern cho Firebase? |
| Gift aggregation lag | Counter không realtime | Tune fixedDelay + monitor lag |
| Agora token expiry | Viewer bị kick | Token TTL management |
GETSET race condition |
Wrong aggregation | Redis GETSET là atomic → đúng design |