diff --git a/src/Tgstation.Server.Host/Configuration/GeneralConfiguration.cs b/src/Tgstation.Server.Host/Configuration/GeneralConfiguration.cs
index 4dc3ef58be..8cc77dcde6 100644
--- a/src/Tgstation.Server.Host/Configuration/GeneralConfiguration.cs
+++ b/src/Tgstation.Server.Host/Configuration/GeneralConfiguration.cs
@@ -23,6 +23,11 @@ namespace Tgstation.Server.Host.Configuration
///
const int DefaultByondTopicTimeout = 5000;
+ ///
+ /// The default value for
+ ///
+ const int DefaultRestartTimeout = 10000;
+
///
/// Minimum length of database user passwords
///
@@ -43,5 +48,10 @@ namespace Tgstation.Server.Host.Configuration
/// The timeout in milliseconds for sending and receiving topics to/from DreamDaemon. Note that a single topic exchange can take up to twice this value
///
public int ByondTopicTimeout { get; set; } = DefaultByondTopicTimeout;
+
+ ///
+ /// The timeout milliseconds for restarting the server
+ ///
+ public int RestartTimeout { get; set; } = DefaultRestartTimeout;
}
}
diff --git a/src/Tgstation.Server.Host/Server.cs b/src/Tgstation.Server.Host/Server.cs
index 3902197ca2..45a683a91e 100644
--- a/src/Tgstation.Server.Host/Server.cs
+++ b/src/Tgstation.Server.Host/Server.cs
@@ -1,12 +1,14 @@
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
+using Microsoft.Extensions.Options;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
+using Tgstation.Server.Host.Configuration;
using Tgstation.Server.Host.Core;
using Tgstation.Server.Host.IO;
@@ -43,6 +45,11 @@ namespace Tgstation.Server.Host
///
ILogger logger;
+ ///
+ /// The for the
+ ///
+ GeneralConfiguration generalConfiguration;
+
///
/// The for the
///
@@ -115,6 +122,8 @@ namespace Tgstation.Server.Host
try
{
logger = webHost.Services.GetRequiredService>();
+ var generalConfigurationOptions = webHost.Services.GetRequiredService>();
+ generalConfiguration = generalConfigurationOptions.Value;
await webHost.RunAsync(cancellationTokenSource.Token).ConfigureAwait(false);
}
catch (OperationCanceledException)
@@ -264,8 +273,7 @@ namespace Tgstation.Server.Host
var cancellationToken = cts.Token;
var eventsTask = Task.WhenAll(restartHandlers.Select(x => x.HandleRestart(newVersion, cancellationToken)).ToList());
- // YA GOT 10 SECONDS
- var expiryTask = Task.Delay(TimeSpan.FromSeconds(10));
+ var expiryTask = Task.Delay(TimeSpan.FromMilliseconds(generalConfiguration.RestartTimeout));
await Task.WhenAny(eventsTask, expiryTask).ConfigureAwait(false);
logger.LogTrace("Joining restart handlers...");
cts.Cancel();
diff --git a/src/Tgstation.Server.Host/appsettings.json b/src/Tgstation.Server.Host/appsettings.json
index 866c3c8eb1..08135f778f 100644
--- a/src/Tgstation.Server.Host/appsettings.json
+++ b/src/Tgstation.Server.Host/appsettings.json
@@ -3,7 +3,8 @@
"MinimumPasswordLength": 15,
"GitHubAccessToken": null,
"SetupWizardMode": "AutoDetect",
- "ByondTopicTimeout": 5000
+ "ByondTopicTimeout": 5000,
+ "RestartTimeout": 10000
},
"FileLogging": {
"Directory": null, //use the default path