1
0
mirror of https://github.com/RaidMax/IW4M-Admin.git synced 2025-06-10 15:20:48 -05:00

provide more informative error if webfront fails to start (typical socket binding)

This commit is contained in:
RaidMax
2023-04-21 20:40:20 -05:00
parent 05f407e3bf
commit 06d28b1a76
2 changed files with 49 additions and 14 deletions

View File

@ -53,6 +53,7 @@ namespace IW4MAdmin
private readonly CommandConfiguration _commandConfiguration;
private EFServer _cachedDatabaseServer;
private readonly StatManager _statManager;
private readonly ApplicationConfiguration _appConfig;
public IW4MServer(
ServerConfiguration serverConfiguration,
@ -77,6 +78,7 @@ namespace IW4MAdmin
_serverCache = serverCache;
_commandConfiguration = commandConfiguration;
_statManager = serviceProvider.GetRequiredService<StatManager>();
_appConfig = serviceProvider.GetService<ApplicationConfiguration>();
IGameServerEventSubscriptions.MonitoringStarted += async (gameEvent, token) =>
{
@ -1269,15 +1271,13 @@ namespace IW4MAdmin
private void RunServerCollection()
{
var appConfig = _serviceProvider.GetService<ApplicationConfiguration>();
if (DateTime.Now - _lastPlayerCount < appConfig?.ServerDataCollectionInterval)
if (DateTime.Now - _lastPlayerCount < _appConfig?.ServerDataCollectionInterval)
{
return;
}
var maxItems = Math.Ceiling(appConfig.MaxClientHistoryTime.TotalMinutes /
appConfig.ServerDataCollectionInterval.TotalMinutes);
var maxItems = Math.Ceiling(_appConfig!.MaxClientHistoryTime.TotalMinutes /
_appConfig.ServerDataCollectionInterval.TotalMinutes);
while (ClientHistory.ClientCounts.Count > maxItems)
{