mirror of
https://github.com/osukey/osukey.git
synced 2025-08-07 08:33:55 +09:00
Limit tracking unhandled scores to just the last one
This commit is contained in:
@ -29,7 +29,7 @@ namespace osu.Game.Online.Solo
|
|||||||
private IAPIProvider api { get; set; } = null!;
|
private IAPIProvider api { get; set; } = null!;
|
||||||
|
|
||||||
private readonly Dictionary<long, StatisticsUpdateCallback> callbacks = new Dictionary<long, StatisticsUpdateCallback>();
|
private readonly Dictionary<long, StatisticsUpdateCallback> callbacks = new Dictionary<long, StatisticsUpdateCallback>();
|
||||||
private readonly HashSet<long> scoresWithoutCallback = new HashSet<long>();
|
private long? lastProcessedScoreId;
|
||||||
|
|
||||||
private readonly Dictionary<string, UserStatistics> latestStatistics = new Dictionary<string, UserStatistics>();
|
private readonly Dictionary<string, UserStatistics> latestStatistics = new Dictionary<string, UserStatistics>();
|
||||||
|
|
||||||
@ -53,7 +53,7 @@ namespace osu.Game.Online.Solo
|
|||||||
|
|
||||||
var callback = new StatisticsUpdateCallback(score, onUpdateReady);
|
var callback = new StatisticsUpdateCallback(score, onUpdateReady);
|
||||||
|
|
||||||
if (scoresWithoutCallback.Remove(score.OnlineID))
|
if (lastProcessedScoreId == score.OnlineID)
|
||||||
{
|
{
|
||||||
requestStatisticsUpdate(api.LocalUser.Value.Id, callback);
|
requestStatisticsUpdate(api.LocalUser.Value.Id, callback);
|
||||||
return;
|
return;
|
||||||
@ -65,7 +65,7 @@ namespace osu.Game.Online.Solo
|
|||||||
private void onUserChanged(APIUser? localUser) => Schedule(() =>
|
private void onUserChanged(APIUser? localUser) => Schedule(() =>
|
||||||
{
|
{
|
||||||
callbacks.Clear();
|
callbacks.Clear();
|
||||||
scoresWithoutCallback.Clear();
|
lastProcessedScoreId = null;
|
||||||
latestStatistics.Clear();
|
latestStatistics.Clear();
|
||||||
|
|
||||||
if (!api.IsLoggedIn)
|
if (!api.IsLoggedIn)
|
||||||
@ -87,11 +87,10 @@ namespace osu.Game.Online.Solo
|
|||||||
if (userId != api.LocalUser.Value?.OnlineID)
|
if (userId != api.LocalUser.Value?.OnlineID)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
lastProcessedScoreId = scoreId;
|
||||||
|
|
||||||
if (!callbacks.TryGetValue(scoreId, out var callback))
|
if (!callbacks.TryGetValue(scoreId, out var callback))
|
||||||
{
|
|
||||||
scoresWithoutCallback.Add(scoreId);
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
requestStatisticsUpdate(userId, callback);
|
requestStatisticsUpdate(userId, callback);
|
||||||
callbacks.Remove(scoreId);
|
callbacks.Remove(scoreId);
|
||||||
|
Reference in New Issue
Block a user