Update ack code after incorrect merge

This commit is contained in:
Dean Herbert 2022-11-12 21:41:10 +09:00
parent dde09d409b
commit ace4099079

View File

@ -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();
}
/// <summary>
@ -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);
}
}
/// <summary>