Documentation
¶
Overview ¶
Package ratelimit provides a shared rate limiter for broker API clients.
It wraps golang.org/x/time/rate to provide context-aware, per-broker request throttling. Multiple callers sharing the same Limiter are serialized correctly without exceeding the configured rate.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Limiter ¶
type Limiter struct {
// contains filtered or unexported fields
}
Limiter throttles API requests using a token-bucket algorithm.
func New ¶
New creates a Limiter that allows rps requests per second with the given burst size. Burst controls how many requests can fire at once before throttling kicks in.
Click to show internal directories.
Click to hide internal directories.