New: Make indexer HTTP requests async

This commit is contained in:
ta264
2021-03-17 21:20:57 +00:00
committed by Qstick
parent 231d43e181
commit 29da0b7031
29 changed files with 216 additions and 213 deletions
@@ -4,6 +4,7 @@ using System.Collections.Specialized;
using System.Globalization;
using System.Linq;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using AngleSharp.Html.Parser;
using FluentValidation;
using NLog;
@@ -45,7 +46,7 @@ namespace NzbDrone.Core.Indexers.Definitions
return new RevolutionTTParser(Settings, Capabilities.Categories, BaseUrl);
}
protected override void DoLogin()
protected override async Task DoLogin()
{
UpdateCookies(null, null);
@@ -55,7 +56,7 @@ namespace NzbDrone.Core.Indexers.Definitions
AllowAutoRedirect = true
};
var loginPage = _httpClient.Execute(new HttpRequest(BaseUrl + "login.php"));
var loginPage = await _httpClient.ExecuteAsync(new HttpRequest(BaseUrl + "login.php"));
requestBuilder.Method = HttpMethod.POST;
requestBuilder.PostProcess += r => r.RequestTimeout = TimeSpan.FromSeconds(15);
@@ -67,7 +68,7 @@ namespace NzbDrone.Core.Indexers.Definitions
.SetHeader("Content-Type", "multipart/form-data")
.Build();
var response = _httpClient.Execute(authLoginRequest);
var response = await _httpClient.ExecuteAsync(authLoginRequest);
if (response.Content != null && response.Content.Contains("/logout.php"))
{