diff --git a/src/NzbDrone.Core/Indexers/Definitions/Cardigann/CardigannRequestGenerator.cs b/src/NzbDrone.Core/Indexers/Definitions/Cardigann/CardigannRequestGenerator.cs index 814799752..17b1a2283 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/Cardigann/CardigannRequestGenerator.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/Cardigann/CardigannRequestGenerator.cs @@ -1073,9 +1073,9 @@ namespace NzbDrone.Core.Indexers.Definitions.Cardigann variables[".Query.Keywords"] = string.Join(" ", keywordTokens); variables[".Keywords"] = ApplyFilters((string)variables[".Query.Keywords"], search.Keywordsfilters, variables); - // TODO: prepare queries first and then send them parallel - var searchPaths = search.Paths; - foreach (var searchPath in searchPaths) + var searchUrls = new List(); + + foreach (var searchPath in search.Paths) { variables[".Categories"] = mappedCategories; @@ -1158,14 +1158,20 @@ namespace NzbDrone.Core.Indexers.Definitions.Cardigann } } - if (method == HttpMethod.Get) + if (method == HttpMethod.Get && queryCollection.Count > 0) { - if (queryCollection.Count > 0) - { - searchUrl += "?" + queryCollection.GetQueryString(_encoding); - } + searchUrl += "?" + queryCollection.GetQueryString(_encoding); + } + + if (method == HttpMethod.Get && searchUrls.Contains(searchUrl)) + { + _logger.Trace("Skip duplicated request {0}", searchUrl); + + continue; } + searchUrls.Add(searchUrl); + _logger.Debug($"Adding request: {searchUrl}"); var requestBuilder = new HttpRequestBuilder(searchUrl)