Fix issue with DMAPI validation shutdown timeouts

- Increase grace period to 30s to avoid false positives.
This commit is contained in:
Jordan Dominion
2023-11-04 17:44:00 -04:00
parent 61cae1a02d
commit fda26e1f15
2 changed files with 7 additions and 4 deletions
+1
View File
@@ -16,6 +16,7 @@ TGS_DEFINE_AND_SET_GLOBAL(tgs, null)
TGS_DEBUG_LOG("About to terminate world. Tick: [world.time], sleep_offline: [world.sleep_offline]")
world.sleep_offline = FALSE // https://www.byond.com/forum/post/2894866
del(world)
world.sleep_offline = FALSE // just in case, this is BYOND after all...
sleep(1)
TGS_DEBUG_LOG("BYOND DIDN'T TERMINATE THE WORLD!!! TICK IS: [world.time], sleep_offline: [world.sleep_offline]")
@@ -689,10 +689,12 @@ namespace Tgstation.Server.Host.Components.Session
return;
}
Logger.LogDebug("Server will terminated in 10s if it does not exit...");
var delayTask = asyncDelayer.Delay(TimeSpan.FromSeconds(10), CancellationToken.None); // DCT: None available
var completedTask = await Task.WhenAny(process.Lifetime, delayTask);
if (completedTask == delayTask)
const int GracePeriodSeconds = 30;
Logger.LogDebug("Server will terminated in {gracePeriodSeconds}s if it does not exit...", GracePeriodSeconds);
var delayTask = asyncDelayer.Delay(TimeSpan.FromSeconds(GracePeriodSeconds), CancellationToken.None); // DCT: None available
await Task.WhenAny(process.Lifetime, delayTask);
if (!process.Lifetime.IsCompleted)
{
Logger.LogWarning("DMAPI took too long to shutdown server after validation request!");
process.Terminate();