ratelimit

package
v0.19.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 25, 2023 License: MIT Imports: 8 Imported by: 14

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL