diff --git a/src/ServiceControl.Config/Framework/RaygunFeedBack.cs b/src/ServiceControl.Config/Framework/RaygunFeedBack.cs index a65c01e12c..6128a68511 100644 --- a/src/ServiceControl.Config/Framework/RaygunFeedBack.cs +++ b/src/ServiceControl.Config/Framework/RaygunFeedBack.cs @@ -138,7 +138,7 @@ async Task TryInitializeRaygunClientWithCredentials(ICredentials? credenti readonly Guid trackingId; readonly RaygunSettings raygunSettings = new() { ApiKey = "zdm49nndHCXZ3NVzM8Kzug==" }; - const string RaygunUrl = "https://raygun.io"; + const string RaygunUrl = "https://raygun.com"; sealed class Feedback(string message) : Exception(message); } diff --git a/src/ServiceControl.Config/UI/Shell/ShellViewModel.cs b/src/ServiceControl.Config/UI/Shell/ShellViewModel.cs index 2dbc21aba8..4760178148 100644 --- a/src/ServiceControl.Config/UI/Shell/ShellViewModel.cs +++ b/src/ServiceControl.Config/UI/Shell/ShellViewModel.cs @@ -94,7 +94,7 @@ protected override async Task OnActivate() { await base.OnActivate(); - await CheckForUpdates(); + BeginCheckForUpdates(); } public async Task RefreshInstances() @@ -121,27 +121,42 @@ void LoadAppVersion() AppVersion = Constants.CurrentVersion; } - async Task CheckForUpdates() + void BeginCheckForUpdates() { - // Get the lates upgradble version based on the current version - // get the json version file from https://s3.us-east-1.amazonaws.com/platformupdate.particular.net/servicecontrol.txt - - var availableUpgradeRelease = await VersionCheckerHelper.GetLatestRelease(AppVersion); - - if (availableUpgradeRelease.Version == AppVersion) - { - UpdateAvailable = false; - } - else + updateCheckTask = Task.Run(async () => { - AvailableUpgradeReleaseLink = availableUpgradeRelease.Assets.FirstOrDefault().Download.ToString(); - UpdateAvailableText = $"v{availableUpgradeRelease.Version} - Update Available"; - UpdateAvailable = true; - } - - NotifyOfPropertyChange(nameof(UpdateAvailable)); + NotifyOfPropertyChange(nameof(IsCheckingForUpdate)); + try + { + // Get the lates upgradeable version based on the current version + // get the json version file from https://s3.us-east-1.amazonaws.com/platformupdate.particular.net/servicecontrol.txt + + var availableUpgradeRelease = await VersionCheckerHelper.GetLatestRelease(AppVersion); + + if (availableUpgradeRelease.Version == AppVersion) + { + UpdateAvailable = false; + } + else + { + AvailableUpgradeReleaseLink = availableUpgradeRelease.Assets.FirstOrDefault().Download.ToString(); + UpdateAvailableText = $"v{availableUpgradeRelease.Version} - Update Available"; + UpdateAvailable = true; + } + + NotifyOfPropertyChange(nameof(UpdateAvailable)); + } + finally + { + updateCheckTask = null; + NotifyOfPropertyChange(nameof(IsCheckingForUpdate)); + } + }); } + public bool IsCheckingForUpdate => updateCheckTask is not null; + + Task updateCheckTask; readonly ListInstancesViewModel listInstances; readonly NoInstancesViewModel noInstances; } diff --git a/src/ServiceControl.Config/UI/Shell/VersionCheckerHelper.cs b/src/ServiceControl.Config/UI/Shell/VersionCheckerHelper.cs index eb54174b6a..e91190b5e3 100644 --- a/src/ServiceControl.Config/UI/Shell/VersionCheckerHelper.cs +++ b/src/ServiceControl.Config/UI/Shell/VersionCheckerHelper.cs @@ -43,11 +43,12 @@ static async Task> GetVersionInformation() } } - static readonly HttpClient httpClient = new HttpClient(new HttpClientHandler + static readonly HttpClient httpClient = new(new HttpClientHandler { AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate }) { + Timeout = TimeSpan.FromSeconds(30), DefaultRequestHeaders = { Accept =