From a89aeaf1cedff164f21eb07d78e0095edc417377 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 2 Nov 2020 17:32:10 +0900 Subject: [PATCH 1/2] Add very basic connection status logging for spectator streaming client --- .../Online/Spectator/SpectatorStreamingClient.cs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/osu.Game/Online/Spectator/SpectatorStreamingClient.cs b/osu.Game/Online/Spectator/SpectatorStreamingClient.cs index cb170ad298..2367651e04 100644 --- a/osu.Game/Online/Spectator/SpectatorStreamingClient.cs +++ b/osu.Game/Online/Spectator/SpectatorStreamingClient.cs @@ -13,6 +13,7 @@ using Newtonsoft.Json; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; +using osu.Framework.Logging; using osu.Game.Beatmaps; using osu.Game.Online.API; using osu.Game.Replays.Legacy; @@ -122,19 +123,26 @@ namespace osu.Game.Online.Spectator isConnected = false; playingUsers.Clear(); - if (ex != null) await tryUntilConnected(); + if (ex != null) + { + Logger.Log($"Spectator client lost connection: {ex}", LoggingTarget.Network); + await tryUntilConnected(); + } }; await tryUntilConnected(); async Task tryUntilConnected() { + Logger.Log("Spectator client connecting...", LoggingTarget.Network); + while (api.State.Value == APIState.Online) { try { // reconnect on any failure await connection.StartAsync(); + Logger.Log("Spectator client connected!", LoggingTarget.Network); // success isConnected = true; @@ -151,8 +159,9 @@ namespace osu.Game.Online.Spectator break; } - catch + catch (Exception e) { + Logger.Log($"Spectator client connection error: {e}", LoggingTarget.Network); await Task.Delay(5000); } } From ab308d28d2ae40350e41b974b7772afd8e175865 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 3 Nov 2020 01:08:35 +0900 Subject: [PATCH 2/2] Debounce calls to UpdateTernaryStates Just something I noticed in passing recently which may help with reducing performance overhead of some batch operations. --- osu.Game/Screens/Edit/Compose/Components/SelectionHandler.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Edit/Compose/Components/SelectionHandler.cs b/osu.Game/Screens/Edit/Compose/Components/SelectionHandler.cs index e346630235..c2441b31a9 100644 --- a/osu.Game/Screens/Edit/Compose/Components/SelectionHandler.cs +++ b/osu.Game/Screens/Edit/Compose/Components/SelectionHandler.cs @@ -419,11 +419,11 @@ namespace osu.Game.Screens.Edit.Compose.Components }; // bring in updates from selection changes - EditorBeatmap.HitObjectUpdated += _ => UpdateTernaryStates(); + EditorBeatmap.HitObjectUpdated += _ => Scheduler.AddOnce(UpdateTernaryStates); EditorBeatmap.SelectedHitObjects.CollectionChanged += (sender, args) => { Scheduler.AddOnce(updateVisibility); - UpdateTernaryStates(); + Scheduler.AddOnce(UpdateTernaryStates); }; }