mirror of
https://github.com/ppy/osu
synced 2025-01-04 13:22:08 +00:00
Fix last silence ID being updated too often, causing most silences to be missed
This commit is contained in:
parent
143c946128
commit
22d8a1160e
@ -9,14 +9,15 @@ namespace osu.Game.Online.API.Requests
|
||||
{
|
||||
public class ChatAckRequest : APIRequest<ChatAckResponse>
|
||||
{
|
||||
public long SinceMessageId;
|
||||
public long? SinceMessageId;
|
||||
public uint? SinceSilenceId;
|
||||
|
||||
protected override WebRequest CreateWebRequest()
|
||||
{
|
||||
var req = base.CreateWebRequest();
|
||||
req.Method = HttpMethod.Post;
|
||||
req.AddParameter(@"since", SinceMessageId.ToString());
|
||||
if (SinceMessageId != null)
|
||||
req.AddParameter(@"since", SinceMessageId.ToString());
|
||||
if (SinceSilenceId != null)
|
||||
req.AddParameter(@"history_since", SinceSilenceId.Value.ToString());
|
||||
return req;
|
||||
|
@ -74,7 +74,7 @@ namespace osu.Game.Online.Chat
|
||||
private bool channelsInitialised;
|
||||
private ScheduledDelegate scheduledAck;
|
||||
|
||||
private long lastMessageId;
|
||||
private long? lastSilenceMessageId;
|
||||
private uint? lastSilenceId;
|
||||
|
||||
public ChannelManager(IAPIProvider api)
|
||||
@ -332,7 +332,7 @@ namespace osu.Game.Online.Chat
|
||||
foreach (var group in messages.GroupBy(m => m.ChannelId))
|
||||
channels.Find(c => c.Id == group.Key)?.AddNewMessages(group.ToArray());
|
||||
|
||||
lastMessageId = messages.LastOrDefault()?.Id ?? lastMessageId;
|
||||
lastSilenceMessageId ??= messages.LastOrDefault()?.Id;
|
||||
}
|
||||
|
||||
private void initializeChannels()
|
||||
@ -394,7 +394,7 @@ namespace osu.Game.Online.Chat
|
||||
|
||||
var req = new ChatAckRequest
|
||||
{
|
||||
SinceMessageId = lastMessageId,
|
||||
SinceMessageId = lastSilenceMessageId,
|
||||
SinceSilenceId = lastSilenceId
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user