From ace4099079889f8b220d8e8514167870dac0cad8 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 12 Nov 2022 21:41:10 +0900 Subject: [PATCH] Update ack code after incorrect merge --- osu.Game/Online/Chat/ChannelManager.cs | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/osu.Game/Online/Chat/ChannelManager.cs b/osu.Game/Online/Chat/ChannelManager.cs index 0aa86fb9d1..bb388b7461 100644 --- a/osu.Game/Online/Chat/ChannelManager.cs +++ b/osu.Game/Online/Chat/ChannelManager.cs @@ -116,20 +116,7 @@ namespace osu.Game.Online.Chat if (apiState.Value != APIState.Online) return; - scheduledAck?.Cancel(); - - var req = new ChatAckRequest(); - req.Success += _ => scheduleNextRequest(); - req.Failure += _ => scheduleNextRequest(); - api.Queue(req); - - // Todo: Handle silences. - - void scheduleNextRequest() - { - scheduledAck?.Cancel(); - scheduledAck = Scheduler.AddDelayed(performChatAckRequest, 60000); - } + SendAck(); } /// @@ -416,6 +403,7 @@ namespace osu.Game.Online.Chat SinceSilenceId = lastSilenceId }; + req.Failure += _ => scheduleNextRequest(); req.Success += ack => { foreach (var silence in ack.Silences) @@ -424,9 +412,17 @@ namespace osu.Game.Online.Chat channel.RemoveMessagesFromUser(silence.UserId); lastSilenceId = Math.Max(lastSilenceId ?? 0, silence.Id); } + + scheduleNextRequest(); }; api.Queue(req); + + void scheduleNextRequest() + { + scheduledAck?.Cancel(); + scheduledAck = Scheduler.AddDelayed(performChatAckRequest, 60000); + } } ///