1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 04:07:25 +08:00

Update MultiplayerClient test output with new knowledge

This commit is contained in:
Dean Herbert 2024-08-15 16:16:48 +09:00
parent 9dc496d6a7
commit 26da2c0637
No known key found for this signature in database

View File

@ -5,14 +5,15 @@ using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Newtonsoft.Json;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Development;
using osu.Framework.Graphics;
using osu.Game.Database;
using osu.Game.Localisation;
using osu.Game.Online.API;
using osu.Game.Online.API.Requests.Responses;
using osu.Game.Online.Multiplayer.Countdown;
@ -22,7 +23,6 @@ using osu.Game.Overlays.Notifications;
using osu.Game.Rulesets;
using osu.Game.Rulesets.Mods;
using osu.Game.Utils;
using osu.Game.Localisation;
namespace osu.Game.Online.Multiplayer
{
@ -777,26 +777,22 @@ namespace osu.Game.Online.Multiplayer
Room.Playlist[Room.Playlist.IndexOf(Room.Playlist.Single(existing => existing.ID == item.ID))] = item;
int existingIndex = APIRoom.Playlist.IndexOf(APIRoom.Playlist.Single(existing => existing.ID == item.ID));
APIRoom.Playlist.RemoveAt(existingIndex);
APIRoom.Playlist.Insert(existingIndex, createPlaylistItem(item));
}
catch (Exception ex)
{
// Temporary code to attempt to figure out long-term failing tests.
bool success = true;
int indexOf = -1234;
StringBuilder exceptionText = new StringBuilder();
try
{
indexOf = APIRoom!.Playlist.IndexOf(APIRoom.Playlist.Single(existing => existing.ID == item.ID));
Room.Playlist[indexOf] = item;
}
catch
{
success = false;
}
exceptionText.AppendLine("MultiplayerClient test failure investigation");
exceptionText.AppendLine($"Exception : {exceptionText}");
exceptionText.AppendLine($"Lookup : {item.ID}");
exceptionText.AppendLine($"Items in Room.Playlist : {string.Join(',', Room.Playlist.Select(i => i.ID))}");
exceptionText.AppendLine($"Items in APIRoom.Playlist: {string.Join(',', APIRoom!.Playlist.Select(i => i.ID))}");
throw new AggregateException($"Index: {indexOf} Length: {Room.Playlist.Count} Retry success: {success} Item: {JsonConvert.SerializeObject(createPlaylistItem(item))}\n\nRoom:{JsonConvert.SerializeObject(APIRoom)}", ex);
throw new AggregateException(exceptionText.ToString());
}
ItemChanged?.Invoke(item);