Table of Contents

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

ShouldThrottle bool

Whether the request should be throttled (delayed).

Delay TimeSpan

The recommended delay before proceeding with the request.

Reason string

Optional human-readable reason for the throttling decision.

Fields

NoThrottle

A result indicating no throttling is needed.

public static readonly ThrottlingResult NoThrottle

Field Value

ThrottlingResult

Properties

Delay

The recommended delay before proceeding with the request.

public TimeSpan Delay { get; init; }

Property Value

TimeSpan

Reason

Optional human-readable reason for the throttling decision.

public string? Reason { get; init; }

Property Value

string

ShouldThrottle

Whether the request should be throttled (delayed).

public bool ShouldThrottle { get; init; }

Property Value

bool

Methods

Throttle(int, string?)

Creates a throttling result with the specified delay in milliseconds.

public static ThrottlingResult Throttle(int delayMs, string? reason = null)

Parameters

delayMs int

The delay in milliseconds.

reason string

Optional reason for throttling.

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

delay TimeSpan

The delay to apply.

reason string

Optional reason for throttling.

Returns

ThrottlingResult

A ThrottlingResult indicating throttling should occur.