mirror of
https://github.com/tgstation/tgstation-server.git
synced 2026-08-29 08:00:19 +01:00
Adds IWatchdog.ResetRebootState
This commit is contained in:
@@ -76,5 +76,12 @@ namespace Tgstation.Server.Host.Components.Watchdog
|
||||
/// <param name="cancellationToken">The <see cref="CancellationToken"/> for the operation</param>
|
||||
/// <returns>A <see cref="Task"/> representing the running operation</returns>
|
||||
Task Terminate(bool graceful, CancellationToken cancellationToken);
|
||||
|
||||
/// <summary>
|
||||
/// Cancels pending graceful actions
|
||||
/// </summary>
|
||||
/// <param name="cancellationToken">The <see cref="CancellationToken"/> for the operation</param>
|
||||
/// <returns>A <see cref="Task"/> representing the running operation</returns>
|
||||
Task ResetRebootState(CancellationToken cancellationToken);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -764,6 +764,19 @@ namespace Tgstation.Server.Host.Components.Watchdog
|
||||
return await LaunchNoLock(true, true, false, cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<WatchdogLaunchResult> 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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user