diff --git a/src/Tgstation.Server.Host/Components/InstanceManager.cs b/src/Tgstation.Server.Host/Components/InstanceManager.cs
index 636d29235e..5fe7cb053a 100644
--- a/src/Tgstation.Server.Host/Components/InstanceManager.cs
+++ b/src/Tgstation.Server.Host/Components/InstanceManager.cs
@@ -28,6 +28,11 @@ namespace Tgstation.Server.Host.Components
///
public Task Ready => readyTcs.Task;
+ ///
+ /// The for the ;
+ ///
+ readonly Lazy lazyRestartRegistration;
+
///
/// The for the
///
@@ -155,7 +160,7 @@ namespace Tgstation.Server.Host.Components
generalConfiguration = generalConfigurationOptions?.Value ?? throw new ArgumentNullException(nameof(generalConfigurationOptions));
this.logger = logger ?? throw new ArgumentNullException(nameof(logger));
- serverControl.RegisterForRestart(this);
+ lazyRestartRegistration = new Lazy(() => serverControl.RegisterForRestart(this));
instances = new Dictionary();
bridgeHandlers = new Dictionary();
@@ -174,6 +179,10 @@ namespace Tgstation.Server.Host.Components
foreach (var I in instances)
I.Value.Dispose();
+
+ lazyRestartRegistration.Value.Dispose();
+
+ logger.LogInformation("Server shutdown");
}
///
@@ -287,6 +296,10 @@ namespace Tgstation.Server.Host.Components
{
logger.LogInformation(assemblyInformationProvider.VersionString);
+ // we do this here because making the restart registration triggers a trace log message
+ // The above log message should be the first one one startup
+ var _ = lazyRestartRegistration.Value;
+
try
{
generalConfiguration.CheckCompatibility(logger);