throttle

package
v0.0.0-...-6313f4c Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2024 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrTimeout          = errors.New("throttle: timeout")
	ErrCapacityExceeded = errors.New("throttle: capacity exceeded")
)

Functions

This section is empty.

Types

type Options

type Options struct {
	BacklogLimit   int
	BacklogTimeout time.Duration
	Limit          int
}

func NewOptions

func NewOptions() *Options

func (*Options) Valid

func (o *Options) Valid() error

type Throttler

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

func New

func New(opts *Options) *Throttler

func (*Throttler) Do

func (t *Throttler) Do(ctx context.Context, fn func(ctx context.Context) error) error

Jump to

Keyboard shortcuts

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