From 202449c40c82c6dfd2d15844c578436bbe3c8872 Mon Sep 17 00:00:00 2001 From: Qstick Date: Mon, 30 Sep 2019 19:44:23 -0400 Subject: [PATCH] Fixed: Provider health checks persist after add until next scheduled check --- .../HealthCheck/Checks/DownloadClientCheck.cs | 1 + .../HealthCheck/Checks/IndexerRssCheck.cs | 1 + .../HealthCheck/Checks/IndexerSearchCheck.cs | 1 + .../ThingiProvider/Events/ProviderAddedEvent.cs | 14 ++++++++++++++ .../ThingiProvider/ProviderFactory.cs | 2 +- 5 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 src/NzbDrone.Core/ThingiProvider/Events/ProviderAddedEvent.cs diff --git a/src/NzbDrone.Core/HealthCheck/Checks/DownloadClientCheck.cs b/src/NzbDrone.Core/HealthCheck/Checks/DownloadClientCheck.cs index f54bfc5e1..d14e21c0e 100644 --- a/src/NzbDrone.Core/HealthCheck/Checks/DownloadClientCheck.cs +++ b/src/NzbDrone.Core/HealthCheck/Checks/DownloadClientCheck.cs @@ -6,6 +6,7 @@ using NzbDrone.Core.ThingiProvider.Events; namespace NzbDrone.Core.HealthCheck.Checks { + [CheckOn(typeof(ProviderAddedEvent))] [CheckOn(typeof(ProviderUpdatedEvent))] [CheckOn(typeof(ProviderDeletedEvent))] [CheckOn(typeof(ProviderStatusChangedEvent))] diff --git a/src/NzbDrone.Core/HealthCheck/Checks/IndexerRssCheck.cs b/src/NzbDrone.Core/HealthCheck/Checks/IndexerRssCheck.cs index 5b27453d9..afe60f11d 100644 --- a/src/NzbDrone.Core/HealthCheck/Checks/IndexerRssCheck.cs +++ b/src/NzbDrone.Core/HealthCheck/Checks/IndexerRssCheck.cs @@ -4,6 +4,7 @@ using NzbDrone.Core.ThingiProvider.Events; namespace NzbDrone.Core.HealthCheck.Checks { + [CheckOn(typeof(ProviderAddedEvent))] [CheckOn(typeof(ProviderUpdatedEvent))] [CheckOn(typeof(ProviderDeletedEvent))] [CheckOn(typeof(ProviderStatusChangedEvent))] diff --git a/src/NzbDrone.Core/HealthCheck/Checks/IndexerSearchCheck.cs b/src/NzbDrone.Core/HealthCheck/Checks/IndexerSearchCheck.cs index b2709e747..d04004583 100644 --- a/src/NzbDrone.Core/HealthCheck/Checks/IndexerSearchCheck.cs +++ b/src/NzbDrone.Core/HealthCheck/Checks/IndexerSearchCheck.cs @@ -4,6 +4,7 @@ using NzbDrone.Core.ThingiProvider.Events; namespace NzbDrone.Core.HealthCheck.Checks { + [CheckOn(typeof(ProviderAddedEvent))] [CheckOn(typeof(ProviderUpdatedEvent))] [CheckOn(typeof(ProviderDeletedEvent))] [CheckOn(typeof(ProviderStatusChangedEvent))] diff --git a/src/NzbDrone.Core/ThingiProvider/Events/ProviderAddedEvent.cs b/src/NzbDrone.Core/ThingiProvider/Events/ProviderAddedEvent.cs new file mode 100644 index 000000000..3b232b0c7 --- /dev/null +++ b/src/NzbDrone.Core/ThingiProvider/Events/ProviderAddedEvent.cs @@ -0,0 +1,14 @@ +using NzbDrone.Common.Messaging; + +namespace NzbDrone.Core.ThingiProvider.Events +{ + public class ProviderAddedEvent : IEvent + { + public ProviderDefinition Definition { get; private set; } + + public ProviderAddedEvent(ProviderDefinition definition) + { + Definition = definition; + } + } +} diff --git a/src/NzbDrone.Core/ThingiProvider/ProviderFactory.cs b/src/NzbDrone.Core/ThingiProvider/ProviderFactory.cs index 94eb6ea0d..0e1a04759 100644 --- a/src/NzbDrone.Core/ThingiProvider/ProviderFactory.cs +++ b/src/NzbDrone.Core/ThingiProvider/ProviderFactory.cs @@ -109,7 +109,7 @@ namespace NzbDrone.Core.ThingiProvider public virtual TProviderDefinition Create(TProviderDefinition definition) { var result = _providerRepository.Insert(definition); - _eventAggregator.PublishEvent(new ProviderUpdatedEvent(result)); + _eventAggregator.PublishEvent(new ProviderAddedEvent(result)); return result; }