TimeoutStrategyOptions
Represents the options for the timeout strategy.
using System;
using System.ComponentModel.DataAnnotations;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.CompilerServices;
using System.Threading.Tasks;
namespace Polly.Timeout
{
[NullableContext(2)]
[Nullable(0)]
public class TimeoutStrategyOptions : ResilienceStrategyOptions
{
[Range(typeof(TimeSpan), "00:00:00.010", "1.00:00:00")]
[UnconditionalSuppressMessage("Trimming", "IL2026", Justification = "Addressed with DynamicDependency on ValidationHelper.Validate method")]
public TimeSpan Timeout { get; set; } = TimeSpan.FromSeconds(30);
[Nullable(new byte[] {
2,
0
})]
[field: Nullable(new byte[] {
2,
0
})]
public Func<TimeoutGeneratorArguments, ValueTask<TimeSpan>> TimeoutGenerator {
[return: Nullable(new byte[] {
2,
0
})]
get;
[param: Nullable(new byte[] {
2,
0
})]
set;
}
public Func<OnTimeoutArguments, ValueTask> OnTimeout { get; set; }
public TimeoutStrategyOptions()
{
base.Name = "Timeout";
}
}
}