Fixed: (Cardigann) Skip duplicated GET requests

pull/1729/head
Bogdan 1 year ago
parent 9042525f22
commit e658e3fe48

@ -1073,9 +1073,9 @@ namespace NzbDrone.Core.Indexers.Definitions.Cardigann
variables[".Query.Keywords"] = string.Join(" ", keywordTokens); variables[".Query.Keywords"] = string.Join(" ", keywordTokens);
variables[".Keywords"] = ApplyFilters((string)variables[".Query.Keywords"], search.Keywordsfilters, variables); variables[".Keywords"] = ApplyFilters((string)variables[".Query.Keywords"], search.Keywordsfilters, variables);
// TODO: prepare queries first and then send them parallel var searchUrls = new List<string>();
var searchPaths = search.Paths;
foreach (var searchPath in searchPaths) foreach (var searchPath in search.Paths)
{ {
variables[".Categories"] = mappedCategories; 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}"); _logger.Debug($"Adding request: {searchUrl}");
var requestBuilder = new HttpRequestBuilder(searchUrl) var requestBuilder = new HttpRequestBuilder(searchUrl)

Loading…
Cancel
Save