RateLimiter

RateLimiter provides an interface for rate limiting HTTP Requests.

Members

Functions

check
bool check(Bucket bucket, Duration timeout)

Check whether a request can be made for a bucket. If the bucket is on cooldown, wait until the cooldown resets before returning.

cooldown
void cooldown(Bucket bucket, Duration duration)

Cooldown a bucket for a given duration. Blocks ALL requests from completing.

update
void update(Bucket bucket, string remaining, string reset, string retryAfter)

Update a given bucket with headers returned from a request.

Variables

cooldowns
LocalManualEvent[Bucket] cooldowns;

Undocumented in source.

states
RateLimitState[Bucket] states;

Undocumented in source.

Meta