RateLimiter

RateLimiter provides an interface for rate limiting HTTP Requests.

TODO: rebuild this

Ideally the RateLimiter can be quite a bit more smart than it currently is, namely: 1. RateLimiter should flush requests slowly, vs spamming all the requests after the cooldown. 2. RateLimiter should take into account how many requests are being queued and cancel/error requests past a certain sane limit to avoid large queues and warn users of bad behavior.

Members

Functions

cooldown
void cooldown(string url, Duration cooldown)

Marks a given key for "cooldown", effectively blocking further requests to wait until the cooldown is expires.

wait
bool wait(string url, Duration timeout)

Waits on a key for up to the given duration.

Variables

cooldowns
Condition[string] cooldowns;
Undocumented in source.

Meta