Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Limiter ¶
Limiter is a simple rate limiter to control how frequently events are allowed to happen.
func NewLimiter ¶
NewLimiter creates a new rate limiter.
func (*Limiter) IsAllowed ¶
IsAllowed returns whether n events may happen now. NB(xichen): If a large request comes in, this could potentially block following requests in the same second from going through. This is a non-issue if the limit is much bigger than the typical batch size, which is indeed the case in the aggregation layer as each batch size is usually fairly small.
Click to show internal directories.
Click to hide internal directories.