Merge pull request #11 from EdisonJwa/fix/reduce-voice-snapshot-polling
perf(ui): stop polling snapshots from audio stats
This commit is contained in:
@@ -311,7 +311,6 @@ class _BetaHomeState extends State<_BetaHome> with WidgetsBindingObserver {
|
|||||||
final List<String> _uiDiagnostics = [];
|
final List<String> _uiDiagnostics = [];
|
||||||
rust.BridgeAudioStats? _audioStats;
|
rust.BridgeAudioStats? _audioStats;
|
||||||
Timer? _statsTimer;
|
Timer? _statsTimer;
|
||||||
int _statsTick = 0;
|
|
||||||
bool _snapshotRefreshInFlight = false;
|
bool _snapshotRefreshInFlight = false;
|
||||||
bool _snapshotRefreshQueued = false;
|
bool _snapshotRefreshQueued = false;
|
||||||
bool _snapshotRefreshQueuedRecordActivity = false;
|
bool _snapshotRefreshQueuedRecordActivity = false;
|
||||||
@@ -815,18 +814,10 @@ class _BetaHomeState extends State<_BetaHome> with WidgetsBindingObserver {
|
|||||||
final s = await rust.audioStats();
|
final s = await rust.audioStats();
|
||||||
if (!mounted) return;
|
if (!mounted) return;
|
||||||
setState(() => _audioStats = s);
|
setState(() => _audioStats = s);
|
||||||
_statsTick += 1;
|
|
||||||
if (_statsTick % 4 == 0) {
|
|
||||||
unawaited(_refreshSnapshotForVoiceStatus());
|
|
||||||
}
|
|
||||||
} catch (_) {}
|
} catch (_) {}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _refreshSnapshotForVoiceStatus() async {
|
|
||||||
await _refreshSnapshot(recordActivity: true, reportErrors: false);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void didChangeAppLifecycleState(AppLifecycleState state) {
|
void didChangeAppLifecycleState(AppLifecycleState state) {
|
||||||
final stateName = state.name;
|
final stateName = state.name;
|
||||||
@@ -1390,7 +1381,6 @@ class _BetaHomeState extends State<_BetaHome> with WidgetsBindingObserver {
|
|||||||
Future<void> _finishDisconnect() async {
|
Future<void> _finishDisconnect() async {
|
||||||
_statsTimer?.cancel();
|
_statsTimer?.cancel();
|
||||||
_statsTimer = null;
|
_statsTimer = null;
|
||||||
_statsTick = 0;
|
|
||||||
_snapshotRefreshInFlight = false;
|
_snapshotRefreshInFlight = false;
|
||||||
_snapshotRefreshQueued = false;
|
_snapshotRefreshQueued = false;
|
||||||
_snapshotRefreshQueuedRecordActivity = false;
|
_snapshotRefreshQueuedRecordActivity = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user