limiter

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Per

func Per(eventCount int, duration time.Duration) rate.Limit

Per calculates the rate of the limiter according to eventCount and duration

Types

type MultiLimiter

type MultiLimiter struct {
	// contains filtered or unexported fields
}

func NewMultiLimiter

func NewMultiLimiter(limiters ...RateLimiter) *MultiLimiter

func (*MultiLimiter) Limit

func (ml *MultiLimiter) Limit() rate.Limit

func (*MultiLimiter) Wait

func (ml *MultiLimiter) Wait(ctx context.Context) error

type RateLimiter

type RateLimiter interface {
	Wait(ctx context.Context) error
	Limit() rate.Limit
}

Jump to

Keyboard shortcuts

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