diff --git a/src/NzbDrone.Core/IndexerProxies/IndexerProxyFactory.cs b/src/NzbDrone.Core/IndexerProxies/IndexerProxyFactory.cs index e62c58dab..a103d676d 100644 --- a/src/NzbDrone.Core/IndexerProxies/IndexerProxyFactory.cs +++ b/src/NzbDrone.Core/IndexerProxies/IndexerProxyFactory.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Linq; using NLog; using NzbDrone.Core.Messaging.Events; using NzbDrone.Core.ThingiProvider; @@ -16,5 +17,10 @@ namespace NzbDrone.Core.IndexerProxies : base(providerRepository, providers, container, eventAggregator, logger) { } + + protected override List Active() + { + return All().Where(c => c.Enable && c.Settings.Validate().IsValid).ToList(); + } } } diff --git a/src/NzbDrone.Core/Indexers/IndexerHttpClient.cs b/src/NzbDrone.Core/Indexers/IndexerHttpClient.cs index 1d351ad92..bca05fc51 100644 --- a/src/NzbDrone.Core/Indexers/IndexerHttpClient.cs +++ b/src/NzbDrone.Core/Indexers/IndexerHttpClient.cs @@ -52,23 +52,14 @@ namespace NzbDrone.Core.Indexers private IIndexerProxy GetProxy(ProviderDefinition definition) { - //Skip DB call if no tags on the indexers + // Skip DB call if no tags on the indexers if (definition.Tags.Count == 0 && definition.Id > 0) { return null; } var proxies = _indexerProxyFactory.GetAvailableProviders(); - IIndexerProxy selectedProxy = null; - - foreach (var proxy in proxies) - { - if (definition.Tags.Intersect(proxy.Definition.Tags).Any()) - { - selectedProxy = proxy; - break; - } - } + var selectedProxy = proxies.FirstOrDefault(proxy => definition.Tags.Intersect(proxy.Definition.Tags).Any()); if (selectedProxy == null && definition.Id == 0) {