diff --git a/src/Tgstation.Server.Host/Swarm/SwarmService.cs b/src/Tgstation.Server.Host/Swarm/SwarmService.cs index af907c1985..ebda13992f 100644 --- a/src/Tgstation.Server.Host/Swarm/SwarmService.cs +++ b/src/Tgstation.Server.Host/Swarm/SwarmService.cs @@ -1117,7 +1117,13 @@ namespace Tgstation.Server.Host.Swarm currentSwarmServers = swarmServers.ToList(); } - logger.LogDebug("Sending updated server list to all {nodeCount} nodes...", currentSwarmServers.Count); + if (currentSwarmServers.Count == 1) + { + logger.LogTrace("Skipping server list broadcast as no nodes are connected!"); + return; + } + + logger.LogDebug("Sending updated server list to all {nodeCount} nodes...", currentSwarmServers.Count - 1); using var httpClient = httpClientFactory.CreateClient(); async Task UpdateRequestForServer(SwarmServerResponse swarmServer) diff --git a/tests/Tgstation.Server.Host.Tests/Swarm/SwarmRpcMapper.cs b/tests/Tgstation.Server.Host.Tests/Swarm/SwarmRpcMapper.cs index f736a7ace6..f0678cd37d 100644 --- a/tests/Tgstation.Server.Host.Tests/Swarm/SwarmRpcMapper.cs +++ b/tests/Tgstation.Server.Host.Tests/Swarm/SwarmRpcMapper.cs @@ -67,7 +67,7 @@ namespace Tgstation.Server.Host.Swarm.Tests if (config == default) Assert.Fail($"Invalid node address: {request.RequestUri}"); - if (!node.Initialized) + if (!node.WebServerOpen) { throw new HttpRequestException("Can't connect to uninitialized node!"); } diff --git a/tests/Tgstation.Server.Host.Tests/Swarm/TestableSwarmNode.cs b/tests/Tgstation.Server.Host.Tests/Swarm/TestableSwarmNode.cs index 248e09bb94..321a37bc46 100644 --- a/tests/Tgstation.Server.Host.Tests/Swarm/TestableSwarmNode.cs +++ b/tests/Tgstation.Server.Host.Tests/Swarm/TestableSwarmNode.cs @@ -36,7 +36,7 @@ namespace Tgstation.Server.Host.Swarm.Tests public ServerUpdateResult UpdateResult { get; set; } public Task UpdateTask { get; private set; } - public bool Initialized { get; private set; } + public bool WebServerOpen { get; private set; } public bool Shutdown { get; private set; } @@ -128,7 +128,7 @@ namespace Tgstation.Server.Host.Swarm.Tests { logger.LogTrace("RecreateControllerAndService..."); var run = ++runCount; - Initialized = false; + WebServerOpen = false; Shutdown = false; CriticalCancellationTokenSource?.Dispose(); @@ -193,7 +193,7 @@ namespace Tgstation.Server.Host.Swarm.Tests public async Task TryInit(bool cancel = false) { logger.LogTrace("TryInit..."); - if (Initialized) + if (WebServerOpen) Assert.Fail("Initialized twice!"); if (!cancel) @@ -211,8 +211,16 @@ namespace Tgstation.Server.Host.Swarm.Tests } else { - result = await Invoke(); - Initialized = true; + try + { + WebServerOpen = true; + result = await Invoke(); + } + catch + { + WebServerOpen = false; + throw; + } } if (Config.ControllerAddress == null)