1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-15 14:23:02 +08:00

Ensure only one update check can be running at a time

This commit is contained in:
Dean Herbert 2020-06-12 18:29:21 +09:00
parent 6beb28b685
commit 3dd642a336

View File

@ -44,12 +44,22 @@ namespace osu.Game.Updater
config.Set(OsuSetting.Version, game.Version);
}
private readonly object updateTaskLock = new object();
private Task updateCheckTask;
public async Task CheckForUpdateAsync()
{
if (!CanCheckForUpdate)
return;
await PerformUpdateCheck();
lock (updateTaskLock)
updateCheckTask ??= PerformUpdateCheck();
await updateCheckTask;
lock (updateTaskLock)
updateCheckTask = null;
}
protected virtual Task PerformUpdateCheck()