limiter

package
v0.28.3 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2019 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Limiter

type Limiter struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

Limiter provides rate per second control

func New

func New(maxRPS, minRPS int) (*Limiter, error)

New returns initialized Limiter

func (*Limiter) Limit

func (l *Limiter) Limit() int

Limit returns the current RPS

func (*Limiter) Lower

func (l *Limiter) Lower() int

Lower reduces the RPS

func (*Limiter) Raise

func (l *Limiter) Raise() int

Raise increase the RPS

func (*Limiter) Wait

func (l *Limiter) Wait(ctx context.Context) error

Wait returns the rate.limiter Wait function

Jump to

Keyboard shortcuts

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