diff --git a/src/NzbDrone.Core.Test/Download/DownloadServiceFixture.cs b/src/NzbDrone.Core.Test/Download/DownloadServiceFixture.cs index bace5b65e..18edda26d 100644 --- a/src/NzbDrone.Core.Test/Download/DownloadServiceFixture.cs +++ b/src/NzbDrone.Core.Test/Download/DownloadServiceFixture.cs @@ -29,7 +29,7 @@ namespace NzbDrone.Core.Test.Download _downloadClients = new List(); Mocker.GetMock() - .Setup(v => v.GetDownloadClients()) + .Setup(v => v.GetDownloadClients(It.IsAny())) .Returns(_downloadClients); Mocker.GetMock() diff --git a/src/NzbDrone.Core.Test/HealthCheck/Checks/DownloadClientCheckFixture.cs b/src/NzbDrone.Core.Test/HealthCheck/Checks/DownloadClientCheckFixture.cs index b1eaec369..5343ac727 100644 --- a/src/NzbDrone.Core.Test/HealthCheck/Checks/DownloadClientCheckFixture.cs +++ b/src/NzbDrone.Core.Test/HealthCheck/Checks/DownloadClientCheckFixture.cs @@ -1,10 +1,10 @@ using System; using System.Collections.Generic; +using Moq; using NUnit.Framework; using NzbDrone.Core.Download; using NzbDrone.Core.HealthCheck.Checks; using NzbDrone.Core.Test.Framework; -using NzbDrone.Test.Common; namespace NzbDrone.Core.Test.HealthCheck.Checks { @@ -15,7 +15,7 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks public void should_return_warning_when_download_client_has_not_been_configured() { Mocker.GetMock() - .Setup(s => s.GetDownloadClients()) + .Setup(s => s.GetDownloadClients(It.IsAny())) .Returns(Array.Empty()); Subject.Check().ShouldBeWarning(); @@ -31,7 +31,7 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks .Throws(); Mocker.GetMock() - .Setup(s => s.GetDownloadClients()) + .Setup(s => s.GetDownloadClients(It.IsAny())) .Returns(new IDownloadClient[] { downloadClient.Object }); Subject.Check().ShouldBeError(); @@ -46,7 +46,7 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks .Returns(new List()); Mocker.GetMock() - .Setup(s => s.GetDownloadClients()) + .Setup(s => s.GetDownloadClients(It.IsAny())) .Returns(new IDownloadClient[] { downloadClient.Object }); Subject.Check().ShouldBeOk(); diff --git a/src/NzbDrone.Core.Test/HealthCheck/Checks/DownloadClientRootFolderCheckFixture.cs b/src/NzbDrone.Core.Test/HealthCheck/Checks/DownloadClientRootFolderCheckFixture.cs index 889872d3c..d58c902e6 100644 --- a/src/NzbDrone.Core.Test/HealthCheck/Checks/DownloadClientRootFolderCheckFixture.cs +++ b/src/NzbDrone.Core.Test/HealthCheck/Checks/DownloadClientRootFolderCheckFixture.cs @@ -44,7 +44,7 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks .Returns(_clientStatus); Mocker.GetMock() - .Setup(s => s.GetDownloadClients()) + .Setup(s => s.GetDownloadClients(It.IsAny())) .Returns(new IDownloadClient[] { _downloadClient.Object }); Mocker.GetMock() diff --git a/src/NzbDrone.Core.Test/HealthCheck/Checks/DownloadClientSortingCheckFixture.cs b/src/NzbDrone.Core.Test/HealthCheck/Checks/DownloadClientSortingCheckFixture.cs index 21044e0fd..b2412f275 100644 --- a/src/NzbDrone.Core.Test/HealthCheck/Checks/DownloadClientSortingCheckFixture.cs +++ b/src/NzbDrone.Core.Test/HealthCheck/Checks/DownloadClientSortingCheckFixture.cs @@ -42,7 +42,7 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks .Returns(_clientStatus); Mocker.GetMock() - .Setup(s => s.GetDownloadClients()) + .Setup(s => s.GetDownloadClients(It.IsAny())) .Returns(new IDownloadClient[] { _downloadClient.Object }); } diff --git a/src/NzbDrone.Core.Test/HealthCheck/Checks/RemotePathMappingCheckFixture.cs b/src/NzbDrone.Core.Test/HealthCheck/Checks/RemotePathMappingCheckFixture.cs index 1581e237b..65ad530ae 100644 --- a/src/NzbDrone.Core.Test/HealthCheck/Checks/RemotePathMappingCheckFixture.cs +++ b/src/NzbDrone.Core.Test/HealthCheck/Checks/RemotePathMappingCheckFixture.cs @@ -63,7 +63,7 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks .Returns(_clientStatus); Mocker.GetMock() - .Setup(s => s.GetDownloadClients()) + .Setup(s => s.GetDownloadClients(It.IsAny())) .Returns(new IDownloadClient[] { _downloadClient.Object }); Mocker.GetMock() diff --git a/src/NzbDrone.Core/Download/DownloadClientProvider.cs b/src/NzbDrone.Core/Download/DownloadClientProvider.cs index 3fa2bcc39..63af8f27f 100644 --- a/src/NzbDrone.Core/Download/DownloadClientProvider.cs +++ b/src/NzbDrone.Core/Download/DownloadClientProvider.cs @@ -10,7 +10,7 @@ namespace NzbDrone.Core.Download public interface IProvideDownloadClient { IDownloadClient GetDownloadClient(DownloadProtocol downloadProtocol, int indexerId = 0); - IEnumerable GetDownloadClients(); + IEnumerable GetDownloadClients(bool filterBlockedClients = false); IDownloadClient Get(int id); } @@ -86,14 +86,39 @@ namespace NzbDrone.Core.Download return provider; } - public IEnumerable GetDownloadClients() + public IEnumerable GetDownloadClients(bool filterBlockedClients = false) { - return _downloadClientFactory.GetAvailableProviders(); + var enabledClients = _downloadClientFactory.GetAvailableProviders(); + + if (filterBlockedClients) + { + return FilterBlockedIndexers(enabledClients).ToList(); + } + + return enabledClients; } public IDownloadClient Get(int id) { return _downloadClientFactory.GetAvailableProviders().Single(d => d.Definition.Id == id); } + + private IEnumerable FilterBlockedIndexers(IEnumerable clients) + { + var blockedClients = _downloadClientStatusService.GetBlockedProviders().ToDictionary(v => v.ProviderId, v => v); + + foreach (var client in clients) + { + DownloadClientStatus blockedClientStatus; + + if (blockedClients.TryGetValue(client.Definition.Id, out blockedClientStatus)) + { + _logger.Debug("Temporarily ignoring client {0} till {1} due to recent failures.", client.Definition.Name, blockedClientStatus.DisabledTill.Value.ToLocalTime()); + continue; + } + + yield return client; + } + } } } diff --git a/src/NzbDrone.Core/HealthCheck/Checks/AppDataLocationCheck.cs b/src/NzbDrone.Core/HealthCheck/Checks/AppDataLocationCheck.cs index bdd994a02..01e7c42b8 100644 --- a/src/NzbDrone.Core/HealthCheck/Checks/AppDataLocationCheck.cs +++ b/src/NzbDrone.Core/HealthCheck/Checks/AppDataLocationCheck.cs @@ -1,6 +1,5 @@ using NzbDrone.Common.EnvironmentInfo; using NzbDrone.Common.Extensions; -using NzbDrone.Core.Configuration.Events; namespace NzbDrone.Core.HealthCheck.Checks { @@ -18,7 +17,7 @@ namespace NzbDrone.Core.HealthCheck.Checks if (_appFolderInfo.StartUpFolder.IsParentPath(_appFolderInfo.AppDataFolder) || _appFolderInfo.StartUpFolder.PathEquals(_appFolderInfo.AppDataFolder)) { - return new HealthCheck(GetType(), HealthCheckResult.Warning, "Updating will not be possible to prevent deleting AppData on Update"); + return new HealthCheck(GetType(), HealthCheckResult.Warning, "Updating will not be possible to prevent deleting AppData on Update", "#updating-will-not-be-possible-to-prevent-deleting-appdata-on-update"); } return new HealthCheck(GetType()); diff --git a/src/NzbDrone.Core/HealthCheck/Checks/DownloadClientCheck.cs b/src/NzbDrone.Core/HealthCheck/Checks/DownloadClientCheck.cs index f54bfc5e1..aca1987b4 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))] @@ -26,7 +27,7 @@ namespace NzbDrone.Core.HealthCheck.Checks if (!downloadClients.Any()) { - return new HealthCheck(GetType(), HealthCheckResult.Warning, "No download client is available"); + return new HealthCheck(GetType(), HealthCheckResult.Warning, "No download client is available", "#no-download-client-is-available"); } foreach (var downloadClient in downloadClients) diff --git a/src/NzbDrone.Core/HealthCheck/Checks/DownloadClientRootFolderCheck.cs b/src/NzbDrone.Core/HealthCheck/Checks/DownloadClientRootFolderCheck.cs index ec92486a1..09b7493a1 100644 --- a/src/NzbDrone.Core/HealthCheck/Checks/DownloadClientRootFolderCheck.cs +++ b/src/NzbDrone.Core/HealthCheck/Checks/DownloadClientRootFolderCheck.cs @@ -12,6 +12,7 @@ using NzbDrone.Core.ThingiProvider.Events; namespace NzbDrone.Core.HealthCheck.Checks { + [CheckOn(typeof(ProviderAddedEvent))] [CheckOn(typeof(ProviderUpdatedEvent))] [CheckOn(typeof(ProviderDeletedEvent))] [CheckOn(typeof(ModelEvent))] @@ -35,7 +36,7 @@ namespace NzbDrone.Core.HealthCheck.Checks public override HealthCheck Check() { // Only check clients not in failure status, those get another message - var clients = _downloadClientProvider.GetDownloadClients(); + var clients = _downloadClientProvider.GetDownloadClients(true); var rootFolders = _rootFolderService.All(); foreach (var client in clients) diff --git a/src/NzbDrone.Core/HealthCheck/Checks/DownloadClientSortingCheck.cs b/src/NzbDrone.Core/HealthCheck/Checks/DownloadClientSortingCheck.cs index cdeac4ce3..2e2cd9a46 100644 --- a/src/NzbDrone.Core/HealthCheck/Checks/DownloadClientSortingCheck.cs +++ b/src/NzbDrone.Core/HealthCheck/Checks/DownloadClientSortingCheck.cs @@ -1,5 +1,4 @@ using System; -using System.Linq; using NLog; using NzbDrone.Common.Extensions; using NzbDrone.Core.Datastore.Events; diff --git a/src/NzbDrone.Core/HealthCheck/Checks/DownloadClientStatusCheck.cs b/src/NzbDrone.Core/HealthCheck/Checks/DownloadClientStatusCheck.cs index 330feacac..b813dbdfd 100644 --- a/src/NzbDrone.Core/HealthCheck/Checks/DownloadClientStatusCheck.cs +++ b/src/NzbDrone.Core/HealthCheck/Checks/DownloadClientStatusCheck.cs @@ -1,4 +1,3 @@ -using System; using System.Linq; using NzbDrone.Common.Extensions; using NzbDrone.Core.Download; diff --git a/src/NzbDrone.Core/HealthCheck/Checks/ImportListRootFolderCheck.cs b/src/NzbDrone.Core/HealthCheck/Checks/ImportListRootFolderCheck.cs index c5aa095de..84f1bf350 100644 --- a/src/NzbDrone.Core/HealthCheck/Checks/ImportListRootFolderCheck.cs +++ b/src/NzbDrone.Core/HealthCheck/Checks/ImportListRootFolderCheck.cs @@ -1,14 +1,15 @@ using System.Collections.Generic; using System.Linq; using NzbDrone.Common.Disk; +using NzbDrone.Common.Extensions; using NzbDrone.Core.ImportLists; using NzbDrone.Core.MediaFiles.Events; -using NzbDrone.Core.RootFolders; -using NzbDrone.Core.Tv; +using NzbDrone.Core.ThingiProvider.Events; using NzbDrone.Core.Tv.Events; namespace NzbDrone.Core.HealthCheck.Checks { + [CheckOn(typeof(ProviderUpdatedEvent))] [CheckOn(typeof(SeriesDeletedEvent))] [CheckOn(typeof(SeriesMovedEvent))] [CheckOn(typeof(EpisodeImportedEvent), CheckOnCondition.FailedOnly)] @@ -40,7 +41,7 @@ namespace NzbDrone.Core.HealthCheck.Checks continue; } - if (!_diskProvider.FolderExists(rootFolderPath)) + if (rootFolderPath.IsNullOrWhiteSpace() || !_diskProvider.FolderExists(rootFolderPath)) { missingRootFolders.Add(rootFolderPath, new List { importList }); } diff --git a/src/NzbDrone.Core/HealthCheck/Checks/IndexerRssCheck.cs b/src/NzbDrone.Core/HealthCheck/Checks/IndexerRssCheck.cs index 65d8f0f24..0624b791f 100644 --- a/src/NzbDrone.Core/HealthCheck/Checks/IndexerRssCheck.cs +++ b/src/NzbDrone.Core/HealthCheck/Checks/IndexerRssCheck.cs @@ -1,4 +1,3 @@ -using System.Linq; using NzbDrone.Common.Extensions; using NzbDrone.Core.Indexers; using NzbDrone.Core.ThingiProvider.Events; @@ -30,7 +29,7 @@ namespace NzbDrone.Core.HealthCheck.Checks if (active.Empty()) { - return new HealthCheck(GetType(), HealthCheckResult.Warning, "All rss-capable indexers are temporarily unavailable due to recent indexer errors"); + return new HealthCheck(GetType(), HealthCheckResult.Warning, "All rss-capable indexers are temporarily unavailable due to recent indexer errors"); } return new HealthCheck(GetType()); diff --git a/src/NzbDrone.Core/HealthCheck/Checks/IndexerSearchCheck.cs b/src/NzbDrone.Core/HealthCheck/Checks/IndexerSearchCheck.cs index c0e02ceed..af1c606da 100644 --- a/src/NzbDrone.Core/HealthCheck/Checks/IndexerSearchCheck.cs +++ b/src/NzbDrone.Core/HealthCheck/Checks/IndexerSearchCheck.cs @@ -1,10 +1,10 @@ -using System.Linq; using NzbDrone.Common.Extensions; using NzbDrone.Core.Indexers; using NzbDrone.Core.ThingiProvider.Events; namespace NzbDrone.Core.HealthCheck.Checks { + [CheckOn(typeof(ProviderAddedEvent))] [CheckOn(typeof(ProviderUpdatedEvent))] [CheckOn(typeof(ProviderDeletedEvent))] [CheckOn(typeof(ProviderStatusChangedEvent))] @@ -23,21 +23,21 @@ namespace NzbDrone.Core.HealthCheck.Checks if (automaticSearchEnabled.Empty()) { - return new HealthCheck(GetType(), HealthCheckResult.Warning, "No indexers available with Automatic Search enabled, Sonarr will not provide any automatic search results"); + return new HealthCheck(GetType(), HealthCheckResult.Warning, "No indexers available with Automatic Search enabled, Sonarr will not provide any automatic search results", "#no-indexers-available-with-automatic-search-enabled-sonarr-will-not-provide-any-automatic-search-results"); } var interactiveSearchEnabled = _indexerFactory.InteractiveSearchEnabled(false); if (interactiveSearchEnabled.Empty()) { - return new HealthCheck(GetType(), HealthCheckResult.Warning, "No indexers available with Interactive Search enabled, Sonarr will not provide any interactive search results"); + return new HealthCheck(GetType(), HealthCheckResult.Warning, "No indexers available with Interactive Search enabled, Sonarr will not provide any interactive search results", "#no-indexers-available-with-interactive-search-enabled"); } var active = _indexerFactory.AutomaticSearchEnabled(true); if (active.Empty()) { - return new HealthCheck(GetType(), HealthCheckResult.Warning, "All search-capable indexers are temporarily unavailable due to recent indexer errors"); + return new HealthCheck(GetType(), HealthCheckResult.Warning, "All search-capable indexers are temporarily unavailable due to recent indexer errors", "#indexers-are-unavailable-due-to-failures"); } return new HealthCheck(GetType()); diff --git a/src/NzbDrone.Core/HealthCheck/Checks/MountCheck.cs b/src/NzbDrone.Core/HealthCheck/Checks/MountCheck.cs index b0b6845dd..fa70365ee 100644 --- a/src/NzbDrone.Core/HealthCheck/Checks/MountCheck.cs +++ b/src/NzbDrone.Core/HealthCheck/Checks/MountCheck.cs @@ -1,6 +1,5 @@ using System.Linq; using NzbDrone.Common.Disk; -using NzbDrone.Common.Extensions; using NzbDrone.Core.Tv; namespace NzbDrone.Core.HealthCheck.Checks diff --git a/src/NzbDrone.Core/HealthCheck/Checks/PackageGlobalMessageCheck.cs b/src/NzbDrone.Core/HealthCheck/Checks/PackageGlobalMessageCheck.cs index 1d76b3b2e..8ed876dea 100644 --- a/src/NzbDrone.Core/HealthCheck/Checks/PackageGlobalMessageCheck.cs +++ b/src/NzbDrone.Core/HealthCheck/Checks/PackageGlobalMessageCheck.cs @@ -1,11 +1,5 @@ -using System; -using System.Linq; -using System.Text.RegularExpressions; -using NLog; using NzbDrone.Common.Extensions; using NzbDrone.Core.Configuration; -using NzbDrone.Core.Download; -using NzbDrone.Core.ThingiProvider.Events; namespace NzbDrone.Core.HealthCheck.Checks { diff --git a/src/NzbDrone.Core/HealthCheck/Checks/ProxyCheck.cs b/src/NzbDrone.Core/HealthCheck/Checks/ProxyCheck.cs index 983958a8f..f80767337 100644 --- a/src/NzbDrone.Core/HealthCheck/Checks/ProxyCheck.cs +++ b/src/NzbDrone.Core/HealthCheck/Checks/ProxyCheck.cs @@ -34,7 +34,7 @@ namespace NzbDrone.Core.HealthCheck.Checks var addresses = Dns.GetHostAddresses(_configService.ProxyHostname); if (!addresses.Any()) { - return new HealthCheck(GetType(), HealthCheckResult.Error, string.Format("Failed to resolve the IP Address for the Configured Proxy Host {0}", _configService.ProxyHostname)); + return new HealthCheck(GetType(), HealthCheckResult.Error, string.Format("Failed to resolve the IP Address for the Configured Proxy Host {0}", _configService.ProxyHostname), "#proxy-failed-resolve-ip"); } var request = _cloudRequestBuilder.Create() @@ -49,13 +49,13 @@ namespace NzbDrone.Core.HealthCheck.Checks if (response.StatusCode == HttpStatusCode.BadRequest) { _logger.Error("Proxy Health Check failed: {0}", response.StatusCode); - return new HealthCheck(GetType(), HealthCheckResult.Error, $"Failed to test proxy. StatusCode: {response.StatusCode}"); + return new HealthCheck(GetType(), HealthCheckResult.Error, $"Failed to test proxy. StatusCode: {response.StatusCode}", "#proxy-failed-test"); } } catch (Exception ex) { _logger.Error(ex, "Proxy Health Check failed"); - return new HealthCheck(GetType(), HealthCheckResult.Error, $"Failed to test proxy: {request.Url}"); + return new HealthCheck(GetType(), HealthCheckResult.Error, $"Failed to test proxy: {request.Url}", "#proxy-failed-test"); } } diff --git a/src/NzbDrone.Core/HealthCheck/Checks/RecyclingBinCheck.cs b/src/NzbDrone.Core/HealthCheck/Checks/RecyclingBinCheck.cs index 8a83faac2..66ee1575c 100644 --- a/src/NzbDrone.Core/HealthCheck/Checks/RecyclingBinCheck.cs +++ b/src/NzbDrone.Core/HealthCheck/Checks/RecyclingBinCheck.cs @@ -29,7 +29,7 @@ namespace NzbDrone.Core.HealthCheck.Checks if (!_diskProvider.FolderWritable(recycleBin)) { - return new HealthCheck(GetType(), HealthCheckResult.Error, $"Unable to write to configured recycling bin folder: {recycleBin}. Ensure this path exists and is writable by the user running Sonarr"); + return new HealthCheck(GetType(), HealthCheckResult.Error, $"Unable to write to configured recycling bin folder: {recycleBin}. Ensure this path exists and is writable by the user running Sonarr", "#cannot-write-recycle-bin"); } return new HealthCheck(GetType()); diff --git a/src/NzbDrone.Core/HealthCheck/Checks/RemotePathMappingCheck.cs b/src/NzbDrone.Core/HealthCheck/Checks/RemotePathMappingCheck.cs index 3e5b8e777..9674db48b 100644 --- a/src/NzbDrone.Core/HealthCheck/Checks/RemotePathMappingCheck.cs +++ b/src/NzbDrone.Core/HealthCheck/Checks/RemotePathMappingCheck.cs @@ -13,13 +13,16 @@ using NzbDrone.Core.Download.Clients; using NzbDrone.Core.MediaFiles.Events; using NzbDrone.Core.RemotePathMappings; using NzbDrone.Core.ThingiProvider.Events; +using NzbDrone.Core.Tv.Events; namespace NzbDrone.Core.HealthCheck.Checks { + [CheckOn(typeof(ProviderAddedEvent))] [CheckOn(typeof(ProviderUpdatedEvent))] [CheckOn(typeof(ProviderDeletedEvent))] [CheckOn(typeof(ModelEvent))] [CheckOn(typeof(EpisodeImportFailedEvent), CheckOnCondition.SuccessfulOnly)] + [CheckOn(typeof(SeriesImportedEvent), CheckOnCondition.SuccessfulOnly)] public class RemotePathMappingCheck : HealthCheckBase, IProvideHealthCheck { private readonly IDiskProvider _diskProvider; @@ -143,7 +146,7 @@ namespace NzbDrone.Core.HealthCheck.Checks // If the previous case did not match then the failure occured in DownloadedEpisodeImportService, // while trying to locate the files reported by the download client // Only check clients not in failure status, those get another message - var client = _downloadClientProvider.GetDownloadClients().FirstOrDefault(x => x.Definition.Name == failureMessage.DownloadClientInfo.Name); + var client = _downloadClientProvider.GetDownloadClients(true).FirstOrDefault(x => x.Definition.Name == failureMessage.DownloadClientInfo.Name); if (client == null) { diff --git a/src/NzbDrone.Core/HealthCheck/Checks/RootFolderCheck.cs b/src/NzbDrone.Core/HealthCheck/Checks/RootFolderCheck.cs index 0034185d9..80ff14f61 100644 --- a/src/NzbDrone.Core/HealthCheck/Checks/RootFolderCheck.cs +++ b/src/NzbDrone.Core/HealthCheck/Checks/RootFolderCheck.cs @@ -1,6 +1,4 @@ -using System.Diagnostics; using System.Linq; -using NLog; using NzbDrone.Common.Disk; using NzbDrone.Core.MediaFiles.Events; using NzbDrone.Core.RootFolders; diff --git a/src/NzbDrone.Core/HealthCheck/Checks/UpdateCheck.cs b/src/NzbDrone.Core/HealthCheck/Checks/UpdateCheck.cs index 0bf858846..8f3da9391 100644 --- a/src/NzbDrone.Core/HealthCheck/Checks/UpdateCheck.cs +++ b/src/NzbDrone.Core/HealthCheck/Checks/UpdateCheck.cs @@ -65,12 +65,9 @@ namespace NzbDrone.Core.HealthCheck.Checks } } - if (BuildInfo.BuildDateTime < DateTime.UtcNow.AddDays(-14)) + if (BuildInfo.BuildDateTime < DateTime.UtcNow.AddDays(-14) && _checkUpdateService.AvailableUpdate() != null) { - if (_checkUpdateService.AvailableUpdate() != null) - { - return new HealthCheck(GetType(), HealthCheckResult.Warning, "New update is available"); - } + return new HealthCheck(GetType(), HealthCheckResult.Warning, "New update is available"); } return new HealthCheck(GetType()); 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 8c58f086f..d8491e9c1 100644 --- a/src/NzbDrone.Core/ThingiProvider/ProviderFactory.cs +++ b/src/NzbDrone.Core/ThingiProvider/ProviderFactory.cs @@ -110,8 +110,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(definition)); return result; }