mirror of
https://github.com/tgstation/tgstation-server.git
synced 2026-08-30 08:33:19 +01:00
Merge pull request #839 from tgstation/838-FixReattachFail
Do not releaseServers if StopAsync fails
This commit is contained in:
@@ -996,20 +996,28 @@ namespace Tgstation.Server.Host.Components.Watchdog
|
||||
/// <inheritdoc />
|
||||
public async Task StopAsync(CancellationToken cancellationToken)
|
||||
{
|
||||
if (releaseServers && Running)
|
||||
try
|
||||
{
|
||||
await StopMonitor().ConfigureAwait(false);
|
||||
|
||||
var reattachInformation = new WatchdogReattachInformation
|
||||
if (releaseServers && Running)
|
||||
{
|
||||
AlphaIsActive = AlphaIsActive
|
||||
};
|
||||
reattachInformation.Alpha = alphaServer?.Release();
|
||||
reattachInformation.Bravo = bravoServer?.Release();
|
||||
await reattachInfoHandler.Save(reattachInformation, cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
await StopMonitor().ConfigureAwait(false);
|
||||
|
||||
await Terminate(false, cancellationToken).ConfigureAwait(false);
|
||||
var reattachInformation = new WatchdogReattachInformation
|
||||
{
|
||||
AlphaIsActive = AlphaIsActive
|
||||
};
|
||||
reattachInformation.Alpha = alphaServer?.Release();
|
||||
reattachInformation.Bravo = bravoServer?.Release();
|
||||
await reattachInfoHandler.Save(reattachInformation, cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
await Terminate(false, cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
catch
|
||||
{
|
||||
releaseServers = false;
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
||||
Reference in New Issue
Block a user