Documentation ¶
Overview ¶
Package ratelimit implements a tg.Invoker that limits request rate.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RateLimiter ¶
type RateLimiter struct {
// contains filtered or unexported fields
}
RateLimiter is a tg.Invoker that throttles RPC calls on underlying invoker.
func New ¶
func New(r rate.Limit, b int) *RateLimiter
New returns a new invoker rate limiter using lim.
func (*RateLimiter) Handle ¶
func (l *RateLimiter) Handle(next tg.Invoker) telegram.InvokeFunc
Handle implements telegram.Middleware.
func (*RateLimiter) WithClock ¶
func (l *RateLimiter) WithClock(c clock.Clock) *RateLimiter
WithClock sets clock to use. Default is to use system clock.
Click to show internal directories.
Click to hide internal directories.