diff --git a/src/NzbDrone.Core/Indexers/Gazelle/Gazelle.cs b/src/NzbDrone.Core/Indexers/Gazelle/Gazelle.cs index fc52e6ad3..3ed452a57 100644 --- a/src/NzbDrone.Core/Indexers/Gazelle/Gazelle.cs +++ b/src/NzbDrone.Core/Indexers/Gazelle/Gazelle.cs @@ -1,4 +1,6 @@ +using System; using System.Collections.Generic; +using System.Linq; using System.Threading.Tasks; using FluentValidation.Results; using NLog; @@ -6,6 +8,7 @@ using NzbDrone.Common.Cache; using NzbDrone.Common.Http; using NzbDrone.Core.Configuration; using NzbDrone.Core.Parser; +using NzbDrone.Core.Parser.Model; using NzbDrone.Core.ThingiProvider; namespace NzbDrone.Core.Indexers.Gazelle @@ -17,6 +20,7 @@ namespace NzbDrone.Core.Indexers.Gazelle public override bool SupportsRss => true; public override bool SupportsSearch => true; public override int PageSize => 50; + public override TimeSpan RateLimit => TimeSpan.FromSeconds(3); private readonly ICached> _authCookieCache; @@ -33,7 +37,7 @@ namespace NzbDrone.Core.Indexers.Gazelle public override IIndexerRequestGenerator GetRequestGenerator() { - return new GazelleRequestGenerator() + return new GazelleRequestGenerator { Settings = Settings, HttpClient = _httpClient, @@ -47,6 +51,18 @@ namespace NzbDrone.Core.Indexers.Gazelle return new GazelleParser(Settings); } + protected override IList CleanupReleases(IEnumerable releases, bool isRecent = false) + { + var cleanReleases = base.CleanupReleases(releases, isRecent); + + if (isRecent) + { + cleanReleases = cleanReleases.Take(50).ToList(); + } + + return cleanReleases; + } + public override IEnumerable DefaultDefinitions { get diff --git a/src/NzbDrone.Core/Indexers/HttpIndexerBase.cs b/src/NzbDrone.Core/Indexers/HttpIndexerBase.cs index 9f60f6e18..5076d578f 100644 --- a/src/NzbDrone.Core/Indexers/HttpIndexerBase.cs +++ b/src/NzbDrone.Core/Indexers/HttpIndexerBase.cs @@ -252,7 +252,7 @@ namespace NzbDrone.Core.Indexers _logger.Error(ex, "An error occurred while processing feed. {0}", url); } - return CleanupReleases(releases); + return CleanupReleases(releases, isRecent); } protected virtual bool IsValidRelease(ReleaseInfo release) diff --git a/src/NzbDrone.Core/Indexers/IndexerBase.cs b/src/NzbDrone.Core/Indexers/IndexerBase.cs index 9d33a96cd..20374fd76 100644 --- a/src/NzbDrone.Core/Indexers/IndexerBase.cs +++ b/src/NzbDrone.Core/Indexers/IndexerBase.cs @@ -72,7 +72,7 @@ namespace NzbDrone.Core.Indexers public abstract Task> Fetch(ArtistSearchCriteria searchCriteria); public abstract HttpRequest GetDownloadRequest(string link); - protected virtual IList CleanupReleases(IEnumerable releases) + protected virtual IList CleanupReleases(IEnumerable releases, bool isRecent = false) { var result = releases.DistinctBy(v => v.Guid).ToList(); diff --git a/src/NzbDrone.Core/Indexers/Redacted/Redacted.cs b/src/NzbDrone.Core/Indexers/Redacted/Redacted.cs index 8cb5024a3..997a16923 100644 --- a/src/NzbDrone.Core/Indexers/Redacted/Redacted.cs +++ b/src/NzbDrone.Core/Indexers/Redacted/Redacted.cs @@ -1,7 +1,11 @@ +using System; +using System.Collections.Generic; +using System.Linq; using NLog; using NzbDrone.Common.Http; using NzbDrone.Core.Configuration; using NzbDrone.Core.Parser; +using NzbDrone.Core.Parser.Model; namespace NzbDrone.Core.Indexers.Redacted { @@ -12,6 +16,7 @@ namespace NzbDrone.Core.Indexers.Redacted public override bool SupportsRss => true; public override bool SupportsSearch => true; public override int PageSize => 50; + public override TimeSpan RateLimit => TimeSpan.FromSeconds(3); public Redacted(IHttpClient httpClient, IIndexerStatusService indexerStatusService, @@ -39,5 +44,17 @@ namespace NzbDrone.Core.Indexers.Redacted return request; } + + protected override IList CleanupReleases(IEnumerable releases, bool isRecent = false) + { + var cleanReleases = base.CleanupReleases(releases, isRecent); + + if (isRecent) + { + cleanReleases = cleanReleases.Take(50).ToList(); + } + + return cleanReleases; + } } }