Struct ThrottlingResult
- Namespace
- RateLimitHeaders.Throttling
- Assembly
- RateLimitHeaders.dll
Represents the result of a throttling algorithm evaluation.
public readonly record struct ThrottlingResult : IEquatable<ThrottlingResult>
- Implements
- Inherited Members
Constructors
ThrottlingResult(bool, TimeSpan, string?)
Represents the result of a throttling algorithm evaluation.
public ThrottlingResult(bool ShouldThrottle, TimeSpan Delay, string? Reason = null)
Parameters
ShouldThrottleboolWhether the request should be throttled (delayed).
DelayTimeSpanThe recommended delay before proceeding with the request.
ReasonstringOptional human-readable reason for the throttling decision.
Fields
NoThrottle
A result indicating no throttling is needed.
public static readonly ThrottlingResult NoThrottle
Field Value
Properties
Delay
The recommended delay before proceeding with the request.
public TimeSpan Delay { get; init; }
Property Value
Reason
Optional human-readable reason for the throttling decision.
public string? Reason { get; init; }
Property Value
ShouldThrottle
Whether the request should be throttled (delayed).
public bool ShouldThrottle { get; init; }
Property Value
Methods
Throttle(int, string?)
Creates a throttling result with the specified delay in milliseconds.
public static ThrottlingResult Throttle(int delayMs, string? reason = null)
Parameters
Returns
- ThrottlingResult
A ThrottlingResult indicating throttling should occur.
Throttle(TimeSpan, string?)
Creates a throttling result with the specified delay.
public static ThrottlingResult Throttle(TimeSpan delay, string? reason = null)
Parameters
Returns
- ThrottlingResult
A ThrottlingResult indicating throttling should occur.