From 3ca2a8d24883290bd453587dd7d1ed7d73700915 Mon Sep 17 00:00:00 2001 From: Cyberboss Date: Sun, 31 May 2020 15:46:19 -0400 Subject: [PATCH] Allow heartbeat time to be changed without a reboot --- .../Models/Internal/DreamDaemonLaunchParameters.cs | 5 ++--- .../Components/Watchdog/WatchdogBase.cs | 13 ++++++------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/Tgstation.Server.Api/Models/Internal/DreamDaemonLaunchParameters.cs b/src/Tgstation.Server.Api/Models/Internal/DreamDaemonLaunchParameters.cs index 647c22c6db..56c4c758b3 100644 --- a/src/Tgstation.Server.Api/Models/Internal/DreamDaemonLaunchParameters.cs +++ b/src/Tgstation.Server.Api/Models/Internal/DreamDaemonLaunchParameters.cs @@ -52,11 +52,10 @@ namespace Tgstation.Server.Api.Models.Internal /// /// The to compare against /// if they match, otherwise - public bool Match(DreamDaemonLaunchParameters otherParameters) => + public bool CanApplyWithoutReboot(DreamDaemonLaunchParameters otherParameters) => AllowWebClient == (otherParameters?.AllowWebClient ?? throw new ArgumentNullException(nameof(otherParameters))) && SecurityLevel == otherParameters.SecurityLevel && PrimaryPort == otherParameters.PrimaryPort - && SecondaryPort == otherParameters.SecondaryPort - && HeartbeatSeconds == otherParameters.HeartbeatSeconds; // We intentionally don't check StartupTimeout as it doesn't matter + && SecondaryPort == otherParameters.SecondaryPort; // We intentionally don't check StartupTimeout or heartbeat seconds as it doesn't matter in terms of the watchdog } } \ No newline at end of file diff --git a/src/Tgstation.Server.Host/Components/Watchdog/WatchdogBase.cs b/src/Tgstation.Server.Host/Components/Watchdog/WatchdogBase.cs index b5087c1c1c..4d2db18c2d 100644 --- a/src/Tgstation.Server.Host/Components/Watchdog/WatchdogBase.cs +++ b/src/Tgstation.Server.Host/Components/Watchdog/WatchdogBase.cs @@ -743,14 +743,13 @@ namespace Tgstation.Server.Host.Components.Watchdog { using (await SemaphoreSlimContext.Lock(Semaphore, cancellationToken).ConfigureAwait(false)) { - if (launchParameters.Match(ActiveLaunchParameters)) - return; + bool match = launchParameters.CanApplyWithoutReboot(ActiveLaunchParameters); ActiveLaunchParameters = launchParameters; - if (Running) - { - ActiveParametersUpdated.TrySetResult(null); // queue an update - ActiveParametersUpdated = new TaskCompletionSource(); - } + if (match || !Running) + return; + + ActiveParametersUpdated.TrySetResult(null); // queue an update + ActiveParametersUpdated = new TaskCompletionSource(); } }