diff --git a/tests/Tgstation.Server.Tests/Live/Instance/InstanceTest.cs b/tests/Tgstation.Server.Tests/Live/Instance/InstanceTest.cs index ab94a4b8cc..164bff1b7e 100644 --- a/tests/Tgstation.Server.Tests/Live/Instance/InstanceTest.cs +++ b/tests/Tgstation.Server.Tests/Live/Instance/InstanceTest.cs @@ -169,20 +169,21 @@ namespace Tgstation.Server.Tests.Live.Instance async Task UpdateDMSettings() { - for (var i = 0; i < 10; ++i) + const int Limit = 10; + for (var i = 0; i < Limit; ++i) try { - global::System.Console.WriteLine($"PORT REUSE BUG 6: Setting I-{instanceClient.Metadata.Id} DM to {dmPort}"); + if (i != 0) + { + global::System.Console.WriteLine($"PORT REUSE BUG 6: Setting I-{instanceClient.Metadata.Id} DM to {dmPort}"); + } await instanceClient.DreamMaker.Update(new DreamMakerRequest { ApiValidationPort = dmPort, }, cancellationToken); } - catch (ConflictException ex) when (ex.ErrorCode == ErrorCode.PortNotAvailable) + catch (ConflictException ex) when (ex.ErrorCode == ErrorCode.PortNotAvailable && i < (Limit - 1)) { - if (i == 4) - throw; - // I have no idea why this happens sometimes await Task.Delay(TimeSpan.FromSeconds(3), cancellationToken); }