mirror of
https://github.com/Jackett/Jackett
synced 2025-01-02 13:16:16 +00:00
IndexerManagerService: create own IWebClient instance for each indexer
This commit is contained in:
parent
d03cbefa57
commit
fc55882f16
1 changed files with 13 additions and 3 deletions
|
@ -33,17 +33,21 @@ namespace Jackett.Services
|
|||
private IIndexerConfigurationService configService;
|
||||
private IProtectionService protectionService;
|
||||
private IWebClient webClient;
|
||||
private IProcessService processService;
|
||||
private IConfigurationService globalConfigService;
|
||||
|
||||
private Logger logger;
|
||||
|
||||
private Dictionary<string, IIndexer> indexers = new Dictionary<string, IIndexer>();
|
||||
private AggregateIndexer aggregateIndexer;
|
||||
|
||||
public IndexerManagerService(IIndexerConfigurationService config, IProtectionService protectionService, IWebClient webClient, Logger l, ICacheService cache)
|
||||
public IndexerManagerService(IIndexerConfigurationService config, IProtectionService protectionService, IWebClient webClient, Logger l, ICacheService cache, IProcessService processService, IConfigurationService globalConfigService)
|
||||
{
|
||||
configService = config;
|
||||
this.protectionService = protectionService;
|
||||
this.webClient = webClient;
|
||||
this.processService = processService;
|
||||
this.globalConfigService = globalConfigService;
|
||||
logger = l;
|
||||
cacheService = cache;
|
||||
}
|
||||
|
@ -70,7 +74,10 @@ namespace Jackett.Services
|
|||
var constructor = type.GetConstructor(constructorArgumentTypes);
|
||||
if (constructor != null)
|
||||
{
|
||||
var arguments = new object[] { configService, webClient, logger, protectionService };
|
||||
// create own webClient instance for each indexer (seperate cookies stores, etc.)
|
||||
var indexerWebClientInstance = (IWebClient)Activator.CreateInstance(webClient.GetType(), processService, logger, globalConfigService);
|
||||
|
||||
var arguments = new object[] { configService, indexerWebClientInstance, logger, protectionService };
|
||||
var indexer = (IIndexer)constructor.Invoke(arguments);
|
||||
return indexer;
|
||||
}
|
||||
|
@ -115,7 +122,10 @@ namespace Jackett.Services
|
|||
});
|
||||
var cardigannIndexers = definitions.Select(definition =>
|
||||
{
|
||||
IIndexer indexer = new CardigannIndexer(configService, webClient, logger, protectionService, definition);
|
||||
// create own webClient instance for each indexer (seperate cookies stores, etc.)
|
||||
var indexerWebClientInstance = (IWebClient)Activator.CreateInstance(webClient.GetType(), processService, logger, globalConfigService);
|
||||
|
||||
IIndexer indexer = new CardigannIndexer(configService, indexerWebClientInstance, logger, protectionService, definition);
|
||||
configService.Load(indexer);
|
||||
return indexer;
|
||||
}).ToList(); // Explicit conversion to list to avoid repeated resource loading
|
||||
|
|
Loading…
Reference in a new issue