Class RateLimitOptions
- Namespace
- Kevlar
- Assembly
- Kevlar.dll
Configuration for a token-bucket rate limit strategy: Permits executions per Window, with bursts up to Burst and optional queueing.
public sealed class RateLimitOptions
- Inheritance
-
RateLimitOptions
- Inherited Members
Remarks
When an execution is rejected, rejection metrics are recorded and OnRejected runs and is awaited. Callback failures are reported through OnCallbackError and do not replace the rejection.
Constructors
RateLimitOptions()
public RateLimitOptions()
Properties
Burst
Maximum permits that can accumulate for bursting. Defaults to Permits.
public int? Burst { get; set; }
Property Value
- int?
Name
An optional low-cardinality name used by strategy telemetry.
public string? Name { get; set; }
Property Value
OnRejected
Invoked and awaited when an execution is rejected. Return default from a synchronous callback.
public Func<RateLimitRejectedEvent, ValueTask>? OnRejected { get; set; }
Property Value
Permits
Sustained number of executions allowed per Window. Default 100.
public int Permits { get; set; }
Property Value
QueueLimit
How many executions may wait for a permit instead of being rejected immediately. Waiting executions are delayed until their reserved permit is replenished. Default 0.
public int QueueLimit { get; set; }
Property Value
Window
The time window over which Permits are replenished. Default 1 second.
public TimeSpan Window { get; set; }