diff --git a/src/SiteMonitor/ViewModels/MainWindowViewModel.cs b/src/SiteMonitor/ViewModels/MainWindowViewModel.cs index 43ee0ee..2b9e4ef 100644 --- a/src/SiteMonitor/ViewModels/MainWindowViewModel.cs +++ b/src/SiteMonitor/ViewModels/MainWindowViewModel.cs @@ -180,7 +180,7 @@ public string? SshPassword { /// private async Task OnRestart() { using SshClient client = new(_serverAddress!, _sshUsername!, _sshPassword!); - await client.ConnectAsync(CancellationToken.None); + await client.ConnectAsync(CancellationToken.None).ConfigureAwait(false); string command = "shutdown -r now"; using SshCommand? ssh = client.RunCommand($"echo {_sshPassword} | sudo -S {command}"); } @@ -191,7 +191,7 @@ private async Task OnRestart() { private async Task OnRestartImages() { await Task.Run(async () => { using SshClient client = new(_serverAddress!, _sshUsername!, _sshPassword!); - await client.ConnectAsync(CancellationToken.None); + await client.ConnectAsync(CancellationToken.None).ConfigureAwait(false); string[] command = [ "docker compose -p nullinside-ui restart", "docker compose -p nullinside-api restart", @@ -202,7 +202,7 @@ await Task.Run(async () => { foreach (string line in command) { using SshCommand? ssh = client.RunCommand($"echo {_sshPassword} | sudo -S {line}"); } - }); + }).ConfigureAwait(false); } /// @@ -217,10 +217,10 @@ private void OnShowCommands() { /// private async Task PingSite() { while (true) { - WebsiteUp = await SendHeadRequest("https://nullinside.com"); - ApiUp = await SendHeadRequest("https://nullinside.com/api/v1/featureToggle"); - NullUp = await SendHeadRequest("https://nullinside.com/null/v1/database/migration"); - (HttpStatusCode, string?) chat = await SendGetRequest("https://nullinside.com/twitch-bot/v1/bot/chat/timestamp"); + WebsiteUp = await SendHeadRequest("https://nullinside.com").ConfigureAwait(false); + ApiUp = await SendHeadRequest("https://nullinside.com/api/v1/featureToggle").ConfigureAwait(false); + NullUp = await SendHeadRequest("https://nullinside.com/null/v1/database/migration").ConfigureAwait(false); + (HttpStatusCode, string?) chat = await SendGetRequest("https://nullinside.com/twitch-bot/v1/bot/chat/timestamp").ConfigureAwait(false); bool chatNotUpdating = false; if (HttpStatusCode.OK == chat.Item1 && null != chat.Item2) { ChatTimestamp = chat.Item2; @@ -242,7 +242,7 @@ private async Task PingSite() { WindowState = WindowState.Normal; } - await Task.Delay(TimeSpan.FromSeconds(10)); + await Task.Delay(TimeSpan.FromSeconds(10)).ConfigureAwait(false); } } @@ -258,7 +258,7 @@ private async Task SendHeadRequest(string address) { using var httpClient = new HttpClient(handler); using var request = new HttpRequestMessage(HttpMethod.Get, address); request.Headers.TryAddWithoutValidation("user-agent", Nullinside.Api.Common.Constants.FAKE_USER_AGENT); - HttpResponseMessage response = await httpClient.SendAsync(request); + HttpResponseMessage response = await httpClient.SendAsync(request).ConfigureAwait(false); return response.IsSuccessStatusCode; } catch { @@ -278,8 +278,8 @@ private async Task SendHeadRequest(string address) { using var httpClient = new HttpClient(handler); using var request = new HttpRequestMessage(HttpMethod.Get, address); request.Headers.TryAddWithoutValidation("user-agent", Nullinside.Api.Common.Constants.FAKE_USER_AGENT); - HttpResponseMessage response = await httpClient.SendAsync(request); - return (response.StatusCode, await response.Content.ReadAsStringAsync()); + HttpResponseMessage response = await httpClient.SendAsync(request).ConfigureAwait(false); + return (response.StatusCode, await response.Content.ReadAsStringAsync().ConfigureAwait(false)); } catch { return (HttpStatusCode.InternalServerError, null); @@ -299,7 +299,7 @@ private async Task PingServer() { } catch { } finally { - await Task.Delay(TimeSpan.FromSeconds(10)); + await Task.Delay(TimeSpan.FromSeconds(10)).ConfigureAwait(false); } } } diff --git a/src/SiteMonitor/ViewModels/NewVersionWindowViewModel.cs b/src/SiteMonitor/ViewModels/NewVersionWindowViewModel.cs index d1da320..4d3d249 100644 --- a/src/SiteMonitor/ViewModels/NewVersionWindowViewModel.cs +++ b/src/SiteMonitor/ViewModels/NewVersionWindowViewModel.cs @@ -47,7 +47,7 @@ public NewVersionWindowViewModel() { // asynchronously determine the current version number. Task.Factory.StartNew(async () => { GithubLatestReleaseJson? version = - await GitHubUpdateManager.GetLatestVersion("nullinside-development-group", "nullinside-site-monitor"); + await GitHubUpdateManager.GetLatestVersion("nullinside-development-group", "nullinside-site-monitor").ConfigureAwait(false); if (null == version) { return; diff --git a/src/SiteMonitor/Views/MainWindow.axaml.cs b/src/SiteMonitor/Views/MainWindow.axaml.cs index 4a25caa..8849cb2 100644 --- a/src/SiteMonitor/Views/MainWindow.axaml.cs +++ b/src/SiteMonitor/Views/MainWindow.axaml.cs @@ -64,7 +64,7 @@ protected override void OnInitialized() { // check for a new version of the application. Task.Factory.StartNew(async () => { GithubLatestReleaseJson? serverVersion = - await GitHubUpdateManager.GetLatestVersion("nullinside-development-group", "nullinside-site-monitor"); + await GitHubUpdateManager.GetLatestVersion("nullinside-development-group", "nullinside-site-monitor").ConfigureAwait(false); if (null == serverVersion || string.IsNullOrWhiteSpace(serverVersion.name)) { return; } @@ -90,7 +90,7 @@ protected override void OnInitialized() { DataContext = vm }; - await versionWindow.ShowDialog(this); + await versionWindow.ShowDialog(this).ConfigureAwait(false); } catch { // do nothing, don't crash diff --git a/src/nullinside-api b/src/nullinside-api index 6962fe9..30bc54a 160000 --- a/src/nullinside-api +++ b/src/nullinside-api @@ -1 +1 @@ -Subproject commit 6962fe933e6bfffb71a91293c522214491392980 +Subproject commit 30bc54a97a175b9626b8911a1070700c00ddd153