limiter

package
v1.19.1 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2021 License: MIT Imports: 3 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Run

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

Run represents a single run that is limited by either a number of requests, or can be stopped halfway.

func New

func New(maxRequests, rps int, maxDuration time.Duration) *Run

New returns

func (*Run) More

func (r *Run) More() bool

More returns whether more requests can be started or whether we have reached some limit. If more requests can be made, it blocks until the rate limiter allows another request.

func (*Run) Stop

func (r *Run) Stop()

Stop will ensure that all future calls to More return false.

Jump to

Keyboard shortcuts

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