A Limiter controls how frequently events are allowed to happen.
It implements a "token bucket" of size b, initially full and refilled
at rate r tokens per second.
Informally, in any large enough time interval, the Limiter limits the
rate to r tokens per second, with a maximum burst size of b events.
As a special case, if r == Inf (the infinite rate), b is ignored.
See https://en.wikipedia.org/wiki/Token_bucket for more about token buckets.

The zero value is a valid Limiter, but it will reject all events.
Use NewLimiter to create non-zero Limiters.

Limiter has three main methods, Allow, Reserve, and Wait.
Most callers should use Wait.

Each of the three methods consumes a single token.
They differ in their behavior when no token is available.
If no token is available, Allow returns false.
If no token is available, Reserve returns a reservation for a future token
and the amount of time the caller must wait before using it.
If no token is available, Wait blocks until one can be obtained
or its associated context.Context is canceled.

Burst returns the maximum burst size. Burst is the maximum number of tokens
that can be consumed in a single call to Allow, Reserve, or Wait, so higher
Burst values allow more events to happen at once.
A zero Burst allows no events, unless limit == Inf.

ReserveN returns a Reservation that indicates how long the caller must wait before n events happen.
The Limiter takes this Reservation into account when allowing future events.
ReserveN returns false if n exceeds the Limiter's burst size.
Usage example:

r := lim.ReserveN(time.Now(), 1)
if !r.OK() {
// Not allowed to act! Did you remember to set lim.burst to be > 0 ?
return
}
time.Sleep(r.Delay())
Act()

Use this method if you wish to wait and slow down in accordance with the rate limit without dropping events.
If you need to respect a deadline or cancel the delay, use Wait instead.
To drop or skip events exceeding rate limit, use Allow instead.

SetLimitAt sets a new Limit for the limiter. The new Limit, and Burst, may be violated
or underutilized by those which reserved (using Reserve or Wait) but did not yet act
before SetLimitAt was called.

CancelAt indicates that the reservation holder will not perform the reserved action
and reverses the effects of this Reservation on the rate limit as much as possible,
considering that other reservations may have already been made.

DelayFrom returns the duration for which the reservation holder must wait
before taking the reserved action. Zero duration means act immediately.
InfDuration means the limiter cannot grant the tokens requested in this
Reservation within the maximum wait time.