Close replaced test connection; add Orleans test logging

This commit is contained in:
MpakobecEx 2026-10-21 15:58:47 +05:00
parent edd3dfe0de
commit 7d87447741
2 changed files with 20 additions and 1 deletions

View File

@ -201,7 +201,19 @@ public sealed class MatchGrain : IMatchGrain
IMatchConnection connection,
long resumeFromSeq)
{
_connections.Register(_matchId, seat, connection);
var previous = _connections.Register(_matchId, seat, connection);
if (previous is not null && !ReferenceEquals(previous, connection))
{
try
{
await previous.CloseAsync(4409, "replaced");
}
catch (Exception exception)
{
_logger.LogDebug(exception, "Match {MatchId}: closing old connection failed.", _matchId);
}
}
var attached = await AttachAsync(seat, playerId, resumeFromSeq);
if (!attached)

View File

@ -95,6 +95,13 @@ public class OrleansMatchTests
public void Configure(ISiloBuilder siloBuilder)
{
siloBuilder.ConfigureLogging(logging =>
{
logging.ClearProviders();
logging.AddConsole();
logging.SetMinimumLevel(LogLevel.Debug);
});
siloBuilder.ConfigureServices(services =>
{
var options = ServerTestData.SmallOptions();