ratelimit

package
v0.0.0-...-d0c200b Latest Latest
Warning

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

Go to latest
Published: May 23, 2016 License: MIT Imports: 2 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 interface {
	// Take should block to make sure that the RPS is met.
	Take()
}

Limiter is used to rate limit some process, possibly across goroutines. The process is expected to call Take() before every iteration, which may block to throttle the process.

func New

func New(rps int) Limiter

New returns a Limiter that will limit to the given RPS.

func NewInfinite

func NewInfinite() Limiter

NewInfinite returns a RateLimiter that is not limited.

Jump to

Keyboard shortcuts

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