diff --git a/Daybreak/Services/ApplicationLauncher/ApplicationLauncher.cs b/Daybreak/Services/ApplicationLauncher/ApplicationLauncher.cs index 6f7f2897..c14e0f78 100644 --- a/Daybreak/Services/ApplicationLauncher/ApplicationLauncher.cs +++ b/Daybreak/Services/ApplicationLauncher/ApplicationLauncher.cs @@ -322,7 +322,7 @@ public void RestartDaybreakAsNormalUser() var sw = Stopwatch.StartNew(); while (sw.Elapsed.TotalSeconds < LaunchTimeout.TotalSeconds) { - await Task.Delay(16); + await Task.Delay(500); var gwProcess = Process.GetProcessesByName("gw").FirstOrDefault(); if (gwProcess is null) { diff --git a/Daybreak/Services/Screens/GuildwarsScreenPlacer.cs b/Daybreak/Services/Screens/GuildwarsScreenPlacer.cs index 332dcc7f..fa48f907 100644 --- a/Daybreak/Services/Screens/GuildwarsScreenPlacer.cs +++ b/Daybreak/Services/Screens/GuildwarsScreenPlacer.cs @@ -2,6 +2,7 @@ using Daybreak.Models; using Daybreak.Services.Scanner; using Microsoft.Extensions.Logging; +using System; using System.Collections.Generic; using System.Configuration; using System.Core.Extensions; @@ -13,7 +14,7 @@ namespace Daybreak.Services.Screens; internal sealed class GuildwarsScreenPlacer : IGuildwarsScreenPlacer { - private const int MaxTries = 10; + private static readonly TimeSpan Delay = TimeSpan.FromSeconds(5); private readonly IGuildwarsMemoryCache guildwarsMemoryCache; private readonly ILiveUpdateableOptions liveOptions; @@ -53,18 +54,7 @@ public async Task OnGuildWarsStarted(ApplicationLauncherContext applicationLaunc return; } - var tries = 0; - while (await this.guildwarsMemoryCache.ReadLoginData(CancellationToken.None) is null) - { - await Task.Delay(1000, cancellationToken); - tries++; - if (tries > MaxTries) - { - this.logger.LogInformation("Failed to detect startup of Guildwars. Cancelling screen placement operation"); - return; - } - } - + await Task.Delay(Delay, cancellationToken); this.screenManager.MoveGuildwarsToScreen(screen); return; }