Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RateLimiter ¶
type RateLimiter struct { RequestsPerSecond rate.Limit SecondsBurstCapacity int RequestsPerMinute rate.Limit MinutesBurstCapacity int // contains filtered or unexported fields }
func NewRateLimiter ¶
func NewRateLimiter(reqPerMin rate.Limit, minBurst int) *RateLimiter
NewRateLimiter initializes a new RateLimiter with per-minute ratings
func (*RateLimiter) CanHandle ¶
func (rl *RateLimiter) CanHandle(identifier string) bool
CanHandleRequest checks if the rate limiters allow another request based on both per-second and per-minute limits.
func (*RateLimiter) WithSecondsLimits ¶
func (rl *RateLimiter) WithSecondsLimits(reqPerSec rate.Limit, secBurst int) *RateLimiter
Click to show internal directories.
Click to hide internal directories.