mirror of
https://github.com/Prowlarr/Prowlarr
synced 2026-05-08 21:14:30 +02:00
Apply suggestions from code review
Co-authored-by: Bogdan <mynameisbogdan@users.noreply.github.com>
This commit is contained in:
parent
8fe80f8683
commit
46fbe720be
2 changed files with 9 additions and 8 deletions
|
|
@ -662,10 +662,10 @@ protected virtual async Task<IndexerResponse> FetchIndexerResponse(IndexerReques
|
|||
request.HttpRequest.SuppressHttpError = true;
|
||||
request.HttpRequest.Encoding ??= Encoding;
|
||||
|
||||
if (request.HttpRequest.RequestTimeout == TimeSpan.Zero && Settings.BaseSettings != null)
|
||||
{
|
||||
request.HttpRequest.RequestTimeout = TimeSpan.FromSeconds(Settings.BaseSettings.QueryTimeout);
|
||||
}
|
||||
if (request.HttpRequest.RequestTimeout == TimeSpan.Zero && Settings.BaseSettings is { QueryLimit: not null })
|
||||
{
|
||||
request.HttpRequest.RequestTimeout = TimeSpan.FromSeconds(Settings.BaseSettings.QueryTimeout.Value);
|
||||
}
|
||||
|
||||
var response = await RetryStrategy
|
||||
.ExecuteAsync(static async (state, _) => await state._httpClient.ExecuteProxiedAsync(state.HttpRequest, state.Definition), (_httpClient, request.HttpRequest, Definition))
|
||||
|
|
|
|||
|
|
@ -17,9 +17,10 @@ public IndexerCommonSettingsValidator()
|
|||
.When(c => c.GrabLimit.HasValue)
|
||||
.WithMessage("Should be greater than zero");
|
||||
|
||||
RuleFor(c => c.QueryTimeout)
|
||||
.InclusiveBetween(1, 300)
|
||||
.WithMessage("Must be between 1 and 300 seconds (5 minutes)");
|
||||
RuleFor(c => c.QueryTimeout)
|
||||
.InclusiveBetween(1, 300)
|
||||
.When(c => c.QueryLimit.HasValue)
|
||||
.WithMessage("Must be between 1 and 300 seconds (5 minutes)");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -35,7 +36,7 @@ public class IndexerBaseSettings
|
|||
public int LimitsUnit { get; set; } = (int)IndexerLimitsUnit.Day;
|
||||
|
||||
[FieldDefinition(4, Type = FieldType.Number, Label = "IndexerSettingsQueryTimeout", Unit = "seconds", HelpText = "IndexerSettingsQueryTimeoutHelpText", Advanced = true)]
|
||||
public int QueryTimeout { get; set; } = 100;
|
||||
public int? QueryTimeout { get; set; }
|
||||
}
|
||||
|
||||
public enum IndexerLimitsUnit
|
||||
|
|
|
|||
Loading…
Reference in a new issue