mirror of
https://github.com/Prowlarr/Prowlarr
synced 2025-12-30 20:36:39 +01:00
Filter enabled indexer proxies in Active
This commit is contained in:
parent
b0c2b9119b
commit
8c0bc9ab4e
2 changed files with 8 additions and 11 deletions
|
|
@ -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 @@ public IndexerProxyFactory(IIndexerProxyRepository providerRepository, IEnumerab
|
|||
: base(providerRepository, providers, container, eventAggregator, logger)
|
||||
{
|
||||
}
|
||||
|
||||
protected override List<IndexerProxyDefinition> Active()
|
||||
{
|
||||
return All().Where(c => c.Enable && c.Settings.Validate().IsValid).ToList();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,23 +52,14 @@ public HttpResponse ExecuteProxied(HttpRequest request, ProviderDefinition defin
|
|||
|
||||
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)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue