fix mediatorspam

This commit is contained in:
rootdarkarchon
2023-02-19 20:33:13 +01:00
parent 8ac6251179
commit c66008aa42
2 changed files with 3 additions and 3 deletions

View File

@@ -3,7 +3,7 @@
<PropertyGroup> <PropertyGroup>
<Authors></Authors> <Authors></Authors>
<Company></Company> <Company></Company>
<Version>0.7.32</Version> <Version>0.7.33</Version>
<Description></Description> <Description></Description>
<Copyright></Copyright> <Copyright></Copyright>
<PackageProjectUrl>https://github.com/Penumbra-Sync/client</PackageProjectUrl> <PackageProjectUrl>https://github.com/Penumbra-Sync/client</PackageProjectUrl>

View File

@@ -43,7 +43,7 @@ public class MareMediator : IDisposable
Stopwatch globalStopwatch = Stopwatch.StartNew(); Stopwatch globalStopwatch = Stopwatch.StartNew();
_performanceCollector.LogPerformance(this, $"Publish>{message.GetType().Name}", () => _performanceCollector.LogPerformance(this, $"Publish>{message.GetType().Name}", () =>
{ {
foreach (var subscriber in subscribers.ToList()) foreach (var subscriber in subscribers.Where(s => s.Subscriber != null).ToList())
{ {
try try
{ {
@@ -52,7 +52,7 @@ public class MareMediator : IDisposable
catch (Exception ex) catch (Exception ex)
{ {
_logger.LogCritical(ex, "Error executing {type} for subscriber {subscriber}, removing from Mediator", message.GetType(), subscriber); _logger.LogCritical(ex, "Error executing {type} for subscriber {subscriber}, removing from Mediator", message.GetType(), subscriber);
subscribers.RemoveWhere(s => s == subscriber); _subscriberDict[message.GetType()].RemoveWhere(s => s == subscriber);
} }
} }
}); });