From 383d5464b7bc6a4b64ee8352e2374a60dd2dbc23 Mon Sep 17 00:00:00 2001 From: bakerboy448 <55419169+bakerboy448@users.noreply.github.com> Date: Sat, 11 Dec 2021 15:51:45 -0600 Subject: [PATCH] New: (FlareSolverr Proxy) Configurable Request Timeout Closes #696 --- .../IndexerProxies/FlareSolverr/FlareSolverr.cs | 2 +- .../IndexerProxies/FlareSolverr/FlareSolverrSettings.cs | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/NzbDrone.Core/IndexerProxies/FlareSolverr/FlareSolverr.cs b/src/NzbDrone.Core/IndexerProxies/FlareSolverr/FlareSolverr.cs index 3215c0a39..47c4c0634 100644 --- a/src/NzbDrone.Core/IndexerProxies/FlareSolverr/FlareSolverr.cs +++ b/src/NzbDrone.Core/IndexerProxies/FlareSolverr/FlareSolverr.cs @@ -113,7 +113,7 @@ namespace NzbDrone.Core.IndexerProxies.FlareSolverr var url = request.Url.ToString(); var userAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36"; - var maxTimeout = 60000; + var maxTimeout = Settings.RequestTimeout * 1000; if (request.Method == HttpMethod.GET) { diff --git a/src/NzbDrone.Core/IndexerProxies/FlareSolverr/FlareSolverrSettings.cs b/src/NzbDrone.Core/IndexerProxies/FlareSolverr/FlareSolverrSettings.cs index 0af09fc82..9ea860ba3 100644 --- a/src/NzbDrone.Core/IndexerProxies/FlareSolverr/FlareSolverrSettings.cs +++ b/src/NzbDrone.Core/IndexerProxies/FlareSolverr/FlareSolverrSettings.cs @@ -1,4 +1,5 @@ using FluentValidation; +using NLog.Config; using NzbDrone.Core.Annotations; using NzbDrone.Core.Validation; @@ -9,6 +10,7 @@ namespace NzbDrone.Core.IndexerProxies.FlareSolverr public FlareSolverrSettingsValidator() { RuleFor(c => c.Host).NotEmpty(); + RuleFor(c => c.RequestTimeout).InclusiveBetween(1, 180); } } @@ -19,11 +21,15 @@ namespace NzbDrone.Core.IndexerProxies.FlareSolverr public FlareSolverrSettings() { Host = "http://localhost:8191/"; + RequestTimeout = 60; } [FieldDefinition(0, Label = "Host")] public string Host { get; set; } + [FieldDefinition(2, Label = "Request Timeout", Advanced = true, HelpText = "FlareSolverr maxTimeout Request Parameter", Unit = "seconds")] + public int RequestTimeout { get; set; } + public NzbDroneValidationResult Validate() { return new NzbDroneValidationResult(Validator.Validate(this));