Fix tests getting stuck until terminated (#2025)

This commit is contained in:
Javier Guardia Fernández
2021-09-12 11:42:46 +02:00
committed by GitHub
parent e2dda67eef
commit 2bbdb23716

View File

@@ -1,8 +1,6 @@
using System;
using System.Diagnostics;
using System.IO;
using System.Runtime;
using System.Runtime.InteropServices;
using System.Threading;
using Prometheus;
using Robust.Server.Console;
@@ -35,7 +33,6 @@ using Robust.Shared.Timing;
using Robust.Shared.Utility;
using Serilog.Debugging;
using Serilog.Sinks.Loki;
using Stopwatch = Robust.Shared.Timing.Stopwatch;
namespace Robust.Server
{
@@ -452,6 +449,12 @@ namespace Robust.Server
private void ProcessExiting(object? sender, EventArgs e)
{
// If the main loop is not running the task will never get processed on the main thread
if (!_mainLoop.Running)
{
return;
}
_taskManager.RunOnMainThread(() => Shutdown("ProcessExited"));
// Give the server 10 seconds to shut down.
// If it still hasn't managed to assume it's stuck or something.