1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-06 07:02:54 +08:00

Fix retry loop for channel initialisation resulting in request pile-up

Closes #22060.
This commit is contained in:
Dean Herbert 2023-01-09 16:15:30 +09:00
parent d05e84bb55
commit 13c3d2c254

View File

@ -335,6 +335,11 @@ namespace osu.Game.Online.Chat
private void initializeChannels() private void initializeChannels()
{ {
// This request is self-retrying until it succeeds.
// To avoid requests piling up when not logged in (ie. API is unavailable) exit early.
if (api.IsLoggedIn)
return;
var req = new ListChannelsRequest(); var req = new ListChannelsRequest();
bool joinDefaults = JoinedChannels.Count == 0; bool joinDefaults = JoinedChannels.Count == 0;
@ -350,10 +355,11 @@ namespace osu.Game.Online.Chat
joinChannel(ch); joinChannel(ch);
} }
}; };
req.Failure += error => req.Failure += error =>
{ {
Logger.Error(error, "Fetching channel list failed"); Logger.Error(error, "Fetching channel list failed");
initializeChannels(); Scheduler.AddDelayed(initializeChannels, 60000);
}; };
api.Queue(req); api.Queue(req);