1
0
mirror of https://github.com/ppy/osu.git synced 2026-06-03 06:09:54 +08:00

Fix download requests firing too often in multiplayer spectator

Closes https://github.com/ppy/osu/issues/33785.

Tested on production with debugger attached.
This commit is contained in:
Dean Herbert
2025-06-24 15:57:53 +09:00
Unverified
parent b827299064
commit 0aec52a64e
@@ -111,6 +111,8 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Match
private CancellationTokenSource? downloadCheckCancellation;
private int? lastDownloadCheckedBeatmapId;
private void checkForAutomaticDownload()
{
downloadCheckCancellation?.Cancel();
@@ -132,6 +134,15 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Match
MultiplayerPlaylistItem item = client.Room.CurrentPlaylistItem;
// This method is called every time anything changes in the room.
// This could result in download requests firing far too often, when we only expect them to fire once per beatmap.
//
// Without this check, we would see especially egregious behaviour when a user has hit the download rate limit.
if (lastDownloadCheckedBeatmapId == item.BeatmapID)
return;
lastDownloadCheckedBeatmapId = item.BeatmapID;
// In a perfect world we'd use BeatmapAvailability, but there's no event-driven flow for when a selection changes.
// ie. if selection changes from "not downloaded" to another "not downloaded" we wouldn't get a value changed raised.
beatmapLookupCache