Class RateLimitHandlerOptions
- Namespace
- RateLimitClient
- Assembly
- RateLimitClient.dll
Options for configuring the RateLimitHandler behavior.
public class RateLimitHandlerOptions
- Inheritance
-
objectRateLimitHandlerOptions
Properties
AutoRetryOn429
Automatically retry requests that receive 429 Too Many Requests status. Default is false.
public bool AutoRetryOn429 { get; set; }
Property Value
- bool
EnableProactiveThrottling
Enable proactive throttling when approaching rate limits. When enabled, requests will be gradually slowed as quota is consumed. Default is true.
public bool EnableProactiveThrottling { get; set; }
Property Value
- bool
GetLimitKey
Custom function to determine the tracking key for a URI. Default tracks by scheme and host (e.g., "https://api.example.com").
public Func<Uri, string>? GetLimitKey { get; set; }
Property Value
- Func<Uri, string>
MaxDelayThreshold
Maximum delay threshold to prevent DoS attacks from excessively high values. Default is 5 minutes.
public TimeSpan MaxDelayThreshold { get; set; }
Property Value
- TimeSpan
OnDelayCalculated
Callback invoked when a delay is calculated and applied.
public Action<Uri, TimeSpan>? OnDelayCalculated { get; set; }
Property Value
- Action<Uri, TimeSpan>
OnParsingError
Callback invoked when an error occurs parsing rate limit headers.
public Action<Uri, Exception>? OnParsingError { get; set; }
Property Value
- Action<Uri, Exception>
OnRateLimitHeadersReceived
Callback invoked when rate limit headers are received and parsed.
public Action<Uri, RateLimitHeaders>? OnRateLimitHeadersReceived { get; set; }
Property Value
- Action<Uri, RateLimitHeaders>
OnTooManyRequests
Callback invoked when a 429 Too Many Requests response is received.
public Action<HttpRequestMessage, HttpResponseMessage>? OnTooManyRequests { get; set; }
Property Value
- Action<HttpRequestMessage, HttpResponseMessage>
ProactiveThrottleThreshold
Threshold (0.0 to 1.0) for triggering proactive throttling. Default is 0.8 (80% of quota consumed).
public double ProactiveThrottleThreshold { get; set; }
Property Value
- double
StateExpirationTime
How long rate limit state remains valid without updates. Default is 1 hour.
public TimeSpan StateExpirationTime { get; set; }
Property Value
- TimeSpan
WaitMode
When to apply rate limit delays. Default is BeforeRequest.
public RateLimitWaitMode WaitMode { get; set; }