mirror of
https://github.com/Sonarr/Sonarr
synced 2026-01-26 09:22:40 +01:00
SQUASH in restart loop
This commit is contained in:
parent
f2478f78b3
commit
3d12f28fb4
1 changed files with 12 additions and 3 deletions
|
|
@ -7,6 +7,7 @@
|
|||
using NzbDrone.Common.EnsureThat;
|
||||
using NzbDrone.Common.EnvironmentInfo;
|
||||
using NzbDrone.Common.Messaging;
|
||||
using NzbDrone.Common.Reflection;
|
||||
using NzbDrone.Common.TPL;
|
||||
|
||||
namespace NzbDrone.Core.Messaging.Events
|
||||
|
|
@ -56,9 +57,9 @@ public void PublishEvent<TEvent>(TEvent @event)
|
|||
|
||||
var eventName = GetEventName(@event.GetType());
|
||||
|
||||
if (_runtimeInfo.IsExiting && Attribute.IsDefined(@event.GetType(), typeof(LifecycleEventAttribute)))
|
||||
if (_runtimeInfo.IsExiting && @event.GetType().HasAttribute<LifecycleEventAttribute>())
|
||||
{
|
||||
_logger.Debug("Event {0} blocked due to application shutdown", eventName);
|
||||
_logger.Warn("Event {0} blocked due to application shutdown", eventName);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -86,7 +87,15 @@ public void PublishEvent<TEvent>(TEvent @event)
|
|||
{
|
||||
if (!_eventSubscribers.TryGetValue(eventName, out var target))
|
||||
{
|
||||
_eventSubscribers[eventName] = target = new EventSubscribers<TEvent>(_serviceFactory);
|
||||
try
|
||||
{
|
||||
_eventSubscribers[eventName] = target = new EventSubscribers<TEvent>(_serviceFactory);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.Warn(ex, "Unable to resolve event subscribers for {0}, container may be disposed", eventName);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
subscribers = target as EventSubscribers<TEvent>;
|
||||
|
|
|
|||
Loading…
Reference in a new issue