diff --git a/osu.Desktop/Updater/VelopackUpdateManager.cs b/osu.Desktop/Updater/VelopackUpdateManager.cs index e550755fffea..ae58a8793c2d 100644 --- a/osu.Desktop/Updater/VelopackUpdateManager.cs +++ b/osu.Desktop/Updater/VelopackUpdateManager.cs @@ -45,14 +45,17 @@ private void load(INotificationOverlay notifications) private async Task checkForUpdateAsync(UpdateProgressNotification? notification = null) { - // should we schedule a retry on completion of this check? - bool scheduleRecheck = true; + // whether to check again in 30 minutes. generally only if there's an error or no update was found (yet). + bool scheduleRecheck = false; try { // Avoid any kind of update checking while gameplay is running. if (localUserInfo?.IsPlaying.Value == true) + { + scheduleRecheck = true; return false; + } // TODO: we should probably be checking if there's a more recent update, rather than shortcutting here. // Velopack does support this scenario (see https://github.com/ppy/osu/pull/28743#discussion_r1743495975). @@ -67,17 +70,20 @@ private async Task checkForUpdateAsync(UpdateProgressNotification? notific return true; } }); + return true; } pendingUpdate = await updateManager.CheckForUpdatesAsync().ConfigureAwait(false); - // Handle no updates available. + // No update is available. We'll check again later. if (pendingUpdate == null) + { + scheduleRecheck = true; return false; + } - scheduleRecheck = false; - + // An update is found, let's notify the user and start downloading it. if (notification == null) { notification = new UpdateProgressNotification @@ -99,6 +105,7 @@ private async Task checkForUpdateAsync(UpdateProgressNotification? notific catch (Exception e) { // In the case of an error, a separate notification will be displayed. + scheduleRecheck = true; notification.FailDownload(); Logger.Error(e, @"update failed!"); } @@ -113,7 +120,6 @@ private async Task checkForUpdateAsync(UpdateProgressNotification? notific { if (scheduleRecheck) { - // check again in 30 minutes. Scheduler.AddDelayed(() => Task.Run(async () => await checkForUpdateAsync().ConfigureAwait(false)), 60000 * 30); } }