ratelimiter

package
v1.0.21 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2018 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package ratelimiter provides an exceedingly simple rate limiter.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Limiter

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

Limiter is a simple rate limiter.

func NewLimiter

func NewLimiter(limit int) *Limiter

NewLimiter creates a new Limiter with a rate of limit per second.

func (*Limiter) Wait

func (l *Limiter) Wait()

Wait blocks for the amount of time required by the Limiter so as to not exceed its rate.

Jump to

Keyboard shortcuts

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