Merge pull request #11 from EdisonJwa/fix/reduce-voice-snapshot-polling

perf(ui): stop polling snapshots from audio stats
This commit is contained in:
Edison Jwa
2026-05-31 23:44:35 +09:00
committed by GitHub
-10
View File
@@ -311,7 +311,6 @@ class _BetaHomeState extends State<_BetaHome> with WidgetsBindingObserver {
final List<String> _uiDiagnostics = [];
rust.BridgeAudioStats? _audioStats;
Timer? _statsTimer;
int _statsTick = 0;
bool _snapshotRefreshInFlight = false;
bool _snapshotRefreshQueued = false;
bool _snapshotRefreshQueuedRecordActivity = false;
@@ -815,18 +814,10 @@ class _BetaHomeState extends State<_BetaHome> with WidgetsBindingObserver {
final s = await rust.audioStats();
if (!mounted) return;
setState(() => _audioStats = s);
_statsTick += 1;
if (_statsTick % 4 == 0) {
unawaited(_refreshSnapshotForVoiceStatus());
}
} catch (_) {}
});
}
Future<void> _refreshSnapshotForVoiceStatus() async {
await _refreshSnapshot(recordActivity: true, reportErrors: false);
}
@override
void didChangeAppLifecycleState(AppLifecycleState state) {
final stateName = state.name;
@@ -1390,7 +1381,6 @@ class _BetaHomeState extends State<_BetaHome> with WidgetsBindingObserver {
Future<void> _finishDisconnect() async {
_statsTimer?.cancel();
_statsTimer = null;
_statsTick = 0;
_snapshotRefreshInFlight = false;
_snapshotRefreshQueued = false;
_snapshotRefreshQueuedRecordActivity = false;