remove waiting semaphore for marking offline when disposing

This commit is contained in:
Stanley Dimant
2025-01-15 09:26:52 +01:00
committed by Loporrit
parent 5d3b35623e
commit c1ad5194b5
2 changed files with 6 additions and 4 deletions

View File

@@ -192,10 +192,11 @@ public class Pair
return UserPair != null || GroupPair.Any(); return UserPair != null || GroupPair.Any();
} }
public void MarkOffline() public void MarkOffline(bool wait = true)
{ {
try try
{ {
if (wait)
_creationSemaphore.Wait(); _creationSemaphore.Wait();
_onlineUserIdentDto = null; _onlineUserIdentDto = null;
LastReceivedCharacterData = null; LastReceivedCharacterData = null;
@@ -205,6 +206,7 @@ public class Pair
} }
finally finally
{ {
if (wait)
_creationSemaphore.Release(); _creationSemaphore.Release();
} }
} }

View File

@@ -356,7 +356,7 @@ public sealed class PairManager : DisposableMediatorSubscriberBase
Logger.LogDebug("Disposing all Pairs"); Logger.LogDebug("Disposing all Pairs");
Parallel.ForEach(_allClientPairs, item => Parallel.ForEach(_allClientPairs, item =>
{ {
item.Value.MarkOffline(); item.Value.MarkOffline(wait: false);
}); });
RecreateLazy(); RecreateLazy();