Fixed: (Cardigann) Apply RateLimit by using RequestDelay from definitions

This commit is contained in:
Bogdan 2023-01-06 05:57:37 +02:00 committed by Qstick
parent 6646734510
commit aa8048968c
2 changed files with 17 additions and 1 deletions

View file

@ -30,9 +30,24 @@ namespace NzbDrone.Core.Indexers.Cardigann
public override IndexerPrivacy Privacy => IndexerPrivacy.Private;
// Page size is different per indexer, setting to 1 ensures we don't break out of paging logic
// thinking its a partial page and insteaad all search_path requests are run for each indexer
// thinking its a partial page and instead all search_path requests are run for each indexer
public override int PageSize => 1;
public override TimeSpan RateLimit
{
get
{
var definition = _definitionService.GetCachedDefinition(Settings.DefinitionFile);
if (definition.RequestDelay.HasValue && definition.RequestDelay.Value > base.RateLimit.TotalSeconds)
{
return TimeSpan.FromSeconds(definition.RequestDelay.Value);
}
return base.RateLimit;
}
}
public override IIndexerRequestGenerator GetRequestGenerator()
{
var generator = _generatorCache.Get(Settings.DefinitionFile, () =>

View file

@ -41,6 +41,7 @@ namespace NzbDrone.Core.Indexers.Cardigann
public string Type { get; set; }
public string Language { get; set; }
public string Encoding { get; set; }
public double? RequestDelay { get; set; }
public List<string> Links { get; set; }
public List<string> Legacylinks { get; set; }
public bool Followredirect { get; set; } = false;