Skip to content

Commit dc03618

Browse files
JamesNKCopilot
andcommitted
Apply suggestion from @Copilot
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 07544ce commit dc03618

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

tests/Aspire.Dashboard.Tests/Integration/ServerRetryHelper.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ public static async Task BindPortsWithRetry(Func<List<int>, Task> retryFunc, ILo
3939
var port = GetAvailablePort(nextPortAttempt, logger);
4040
ports.Add(port);
4141

42+
// Use a minimum gap of 10 between port allocations to reduce the risk of port collisions.
43+
// Allocating consecutive ports (gap of 0) can lead to conflicts if the OS or other processes
44+
// allocate ports in the same range. The random gap further reduces the chance of collision.
4245
nextPortAttempt = port + Random.Shared.Next(10, 100);
4346
}
4447

0 commit comments

Comments
 (0)