From 308e71d8c9436c50286cab4f79b267de3ba68eb3 Mon Sep 17 00:00:00 2001 From: Jordan Brown Date: Sat, 11 Jul 2020 10:03:30 -0400 Subject: [PATCH] Make the first log message the server version --- .../Components/InstanceManager.cs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) 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);