fix: harden reconnect and playback regressions

This commit is contained in:
edde746
2026-05-31 20:33:38 +02:00
parent c6c76d6828
commit d5c8778074
16 changed files with 201 additions and 32 deletions
+12
View File
@@ -138,6 +138,7 @@ class MultiServerProvider extends ChangeNotifier with DisposableChangeNotifierMi
MultiServerProvider(this._serverManager, this._aggregationService) {
// Listen to server status changes
_statusSubscription = _serverManager.statusStream.listen((_) {
_promoteOnlineExpectedServers();
final currentOnline = Set<String>.from(onlineServerIds);
final hasNewServer = currentOnline.any((id) => !_previousOnlineServerIds.contains(id));
_previousOnlineServerIds = currentOnline;
@@ -157,6 +158,17 @@ class MultiServerProvider extends ChangeNotifier with DisposableChangeNotifierMi
});
}
void _promoteOnlineExpectedServers() {
final visible = _visibleServerIds;
final expected = _expectedVisibleServerIds;
if (visible == null || expected == null || expected.isEmpty) return;
final onlineExpected = _serverManager.onlineServerIds.where(expected.contains).where((id) => !visible.contains(id));
if (onlineExpected.isEmpty) return;
_visibleServerIds = {...visible, ...onlineExpected};
}
/// Get the multi-server manager
MultiServerManager get serverManager => _serverManager;