diff --git a/src/Tgstation.Server.Host/Components/Watchdog/IWatchdog.cs b/src/Tgstation.Server.Host/Components/Watchdog/IWatchdog.cs index 21a45d3e60..6c8b65b05f 100644 --- a/src/Tgstation.Server.Host/Components/Watchdog/IWatchdog.cs +++ b/src/Tgstation.Server.Host/Components/Watchdog/IWatchdog.cs @@ -76,5 +76,12 @@ namespace Tgstation.Server.Host.Components.Watchdog /// The for the operation /// A representing the running operation Task Terminate(bool graceful, CancellationToken cancellationToken); + + /// + /// Cancels pending graceful actions + /// + /// The for the operation + /// A representing the running operation + Task ResetRebootState(CancellationToken cancellationToken); } } diff --git a/src/Tgstation.Server.Host/Components/Watchdog/Watchdog.cs b/src/Tgstation.Server.Host/Components/Watchdog/Watchdog.cs index e51e28e9a2..bbd159f5a4 100644 --- a/src/Tgstation.Server.Host/Components/Watchdog/Watchdog.cs +++ b/src/Tgstation.Server.Host/Components/Watchdog/Watchdog.cs @@ -764,6 +764,19 @@ namespace Tgstation.Server.Host.Components.Watchdog return await LaunchNoLock(true, true, false, cancellationToken).ConfigureAwait(false); } + /// + public async Task ResetRebootState(CancellationToken cancellationToken) + { + using (await SemaphoreSlimContext.Lock(semaphore, cancellationToken).ConfigureAwait(false)) + { + if (!Running) + return; + var toClear = AlphaIsActive ? alphaServer : bravoServer; + if (toClear != null) + toClear.ResetRebootState(); + } + } + /// public async Task Restart(bool graceful, CancellationToken cancellationToken) { @@ -784,12 +797,10 @@ namespace Tgstation.Server.Host.Components.Watchdog return result; } var toReboot = AlphaIsActive ? alphaServer : bravoServer; - var other = AlphaIsActive ? bravoServer : alphaServer; if (toReboot != null) { if (!await toReboot.SetRebootState(Components.Watchdog.RebootState.Restart, cancellationToken).ConfigureAwait(false)) logger.LogWarning("Unable to send reboot state change event!"); - } return null; }