Commit b2d81c4
feat(TokenBalanceController): Dynamic polling interval per chain (#6357)
## Explanation
### Current State
The `TokenBalancesController` currently uses a single global polling
interval for all chains, with the implementation of *WebSocket-based
balance updates** we need **dynamic interval management** per chain (for
websocket-supported chains and for non-supported chains):
- **WebSocket-supported chains** should use minimal polling when
connected (WebSocket provides real-time updates)
- **WebSocket-disconnected chains** need frequent polling as fallback
- **WebSocket connection status changes dynamically**, requiring runtime
interval adjustments
- The current single-interval approach cannot adapt to changing
WebSocket connectivity states
### Solution
This PR introduces **dynamic per-chain polling intervals** that
integrate seamlessly with the **WebSocket service's connectivity
management**:
1. **Dynamic Interval Control**: WebSocket service can adjust polling
intervals in real-time via messenger actions based on connection status
2. **Connectivity-Aware Polling**: Connected chains use long intervals
(WebSocket handles updates), disconnected chains use short intervals
(polling fallback)
3. **Interval Grouping Strategy**: Chains with the same polling interval
are batched together, preserving AccountsAPI efficiency
4. **Messenger Integration**: `updateChainPollingConfigs` action enables
WebSocket service to control intervals dynamically
### 1 parent e4f8a47 commit b2d81c4
File tree
3 files changed
+1659
-3
lines changed- packages/assets-controllers
- src
3 files changed
+1659
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
| |||
0 commit comments