1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-27 14:52:55 +08:00

Catch http errors in full update process (could happen during downloads too).

This commit is contained in:
Dean Herbert 2017-02-21 12:58:56 +09:00
parent 9e1a3b5d4e
commit bc032aa0a6
No known key found for this signature in database
GPG Key ID: 46D71BF4958ABB49

View File

@ -119,33 +119,35 @@ namespace osu.Desktop.Overlays
try try
{ {
updateManager = await UpdateManager.GitHubUpdateManager(@"https://github.com/ppy/osu", @"osulazer", null, null, true); updateManager = await UpdateManager.GitHubUpdateManager(@"https://github.com/ppy/osu", @"osulazer", null, null, true);
} var info = await updateManager.CheckForUpdate();
catch(HttpRequestException) if (info.ReleasesToApply.Count > 0)
{
//check again every 30 minutes.
Scheduler.AddDelayed(updateChecker, 60000 * 30);
return;
}
if (!updateManager.IsInstalledApp)
return;
var info = await updateManager.CheckForUpdate();
if (info.ReleasesToApply.Count > 0)
{
ProgressNotification n = new UpdateProgressNotification
{ {
Text = @"Downloading update..." ProgressNotification n = new UpdateProgressNotification
}; {
Schedule(() => notification.Post(n)); Text = @"Downloading update..."
Schedule(() => n.State = ProgressNotificationState.Active); };
await updateManager.DownloadReleases(info.ReleasesToApply, (int p) => Schedule(() => n.Progress = p / 100f)); Schedule(() =>
Schedule(() => n.Text = @"Installing update..."); {
await updateManager.ApplyReleases(info, (int p) => Schedule(() => n.Progress = p / 100f)); notification.Post(n);
Schedule(() => n.State = ProgressNotificationState.Completed); n.State = ProgressNotificationState.Active;
});
await updateManager.DownloadReleases(info.ReleasesToApply, p => Schedule(() => n.Progress = p / 100f));
Schedule(() =>
{
n.Progress = 0;
n.Text = @"Installing update...";
});
await updateManager.ApplyReleases(info, p => Schedule(() => n.Progress = p / 100f));
Schedule(() => n.State = ProgressNotificationState.Completed);
}
else
{
//check again every 30 minutes.
Scheduler.AddDelayed(updateChecker, 60000 * 30);
}
} }
else catch (HttpRequestException)
{ {
//check again every 30 minutes. //check again every 30 minutes.
Scheduler.AddDelayed(updateChecker, 60000 * 30); Scheduler.AddDelayed(updateChecker, 60000 * 30);