fix pair offline state

This commit is contained in:
2026-01-17 03:06:46 +09:00
parent 7c281926a5
commit 8be0811b4a
5 changed files with 11 additions and 3 deletions

View File

@@ -137,7 +137,7 @@ public sealed partial class PairCoordinator
_pendingCharacterData.TryRemove(user.UID, out _);
if (registrationResult.Value.CharacterIdent is not null)
{
_ = _handlerRegistry.DeregisterOfflinePair(registrationResult.Value);
_ = _handlerRegistry.DeregisterOfflinePair(registrationResult.Value, forceDisposal: true);
}
_mediator.Publish(new ClearProfileUserDataMessage(user));

View File

@@ -1363,6 +1363,7 @@ internal sealed class PairHandlerAdapter : DisposableMediatorSubscriberBase, IPa
{
PlayerName = null;
_cachedData = null;
LastReceivedCharacterData = null;
_performanceMetricsCache.Clear(Ident);
Logger.LogDebug("Disposing {name} complete", name);
}

View File

@@ -136,6 +136,7 @@ public sealed class PairHandlerRegistry : IDisposable
if (TryFinalizeHandlerRemoval(handler))
{
handler.Dispose();
_pairStateCache.Clear(registration.CharacterIdent);
}
}
else if (shouldScheduleRemoval && handler is not null)
@@ -356,6 +357,7 @@ public sealed class PairHandlerRegistry : IDisposable
finally
{
_pairPerformanceMetricsCache.Clear(handler.Ident);
_pairStateCache.Clear(handler.Ident);
}
}
}
@@ -377,6 +379,7 @@ public sealed class PairHandlerRegistry : IDisposable
{
handler.Dispose();
_pairPerformanceMetricsCache.Clear(handler.Ident);
_pairStateCache.Clear(handler.Ident);
}
}
@@ -401,6 +404,7 @@ public sealed class PairHandlerRegistry : IDisposable
if (TryFinalizeHandlerRemoval(handler))
{
handler.Dispose();
_pairStateCache.Clear(handler.Ident);
}
}

View File

@@ -160,8 +160,9 @@ public sealed class PairManager
return PairOperationResult<PairRegistration>.Fail($"Pair {user.UID} not found.");
}
var ident = connection.Ident;
connection.SetOffline();
return PairOperationResult<PairRegistration>.Ok(new PairRegistration(new PairUniqueIdentifier(user.UID), connection.Ident));
return PairOperationResult<PairRegistration>.Ok(new PairRegistration(new PairUniqueIdentifier(user.UID), ident));
}
}
@@ -530,6 +531,7 @@ public sealed class PairManager
return null;
}
var ident = connection.Ident;
if (connection.IsOnline)
{
connection.SetOffline();
@@ -542,7 +544,7 @@ public sealed class PairManager
shell.Users.Remove(userId);
}
return new PairRegistration(new PairUniqueIdentifier(userId), connection.Ident);
return new PairRegistration(new PairUniqueIdentifier(userId), ident);
}
public static PairConnection CreateFromFullData(UserFullPairDto dto)

View File

@@ -76,6 +76,7 @@ public sealed class PairConnection
public void SetOffline()
{
IsOnline = false;
Ident = null;
}
public void UpdatePermissions(UserPermissions own, UserPermissions other)