mirror of
https://github.com/Jackett/Jackett.git
synced 2025-09-17 17:34:09 +02:00
IndexerManagerService: create own IWebClient instance for each indexer
This commit is contained in:
@@ -33,17 +33,21 @@ namespace Jackett.Services
|
|||||||
private IIndexerConfigurationService configService;
|
private IIndexerConfigurationService configService;
|
||||||
private IProtectionService protectionService;
|
private IProtectionService protectionService;
|
||||||
private IWebClient webClient;
|
private IWebClient webClient;
|
||||||
|
private IProcessService processService;
|
||||||
|
private IConfigurationService globalConfigService;
|
||||||
|
|
||||||
private Logger logger;
|
private Logger logger;
|
||||||
|
|
||||||
private Dictionary<string, IIndexer> indexers = new Dictionary<string, IIndexer>();
|
private Dictionary<string, IIndexer> indexers = new Dictionary<string, IIndexer>();
|
||||||
private AggregateIndexer aggregateIndexer;
|
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;
|
configService = config;
|
||||||
this.protectionService = protectionService;
|
this.protectionService = protectionService;
|
||||||
this.webClient = webClient;
|
this.webClient = webClient;
|
||||||
|
this.processService = processService;
|
||||||
|
this.globalConfigService = globalConfigService;
|
||||||
logger = l;
|
logger = l;
|
||||||
cacheService = cache;
|
cacheService = cache;
|
||||||
}
|
}
|
||||||
@@ -70,7 +74,10 @@ namespace Jackett.Services
|
|||||||
var constructor = type.GetConstructor(constructorArgumentTypes);
|
var constructor = type.GetConstructor(constructorArgumentTypes);
|
||||||
if (constructor != null)
|
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);
|
var indexer = (IIndexer)constructor.Invoke(arguments);
|
||||||
return indexer;
|
return indexer;
|
||||||
}
|
}
|
||||||
@@ -115,7 +122,10 @@ namespace Jackett.Services
|
|||||||
});
|
});
|
||||||
var cardigannIndexers = definitions.Select(definition =>
|
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);
|
configService.Load(indexer);
|
||||||
return indexer;
|
return indexer;
|
||||||
}).ToList(); // Explicit conversion to list to avoid repeated resource loading
|
}).ToList(); // Explicit conversion to list to avoid repeated resource loading
|
||||||
|
Reference in New Issue
Block a user