throttle

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package throttle is used to limit concurrent activities

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AcquireMulti

func AcquireMulti(ctx context.Context, tList []*Throttle) (context.Context, error)

func ReleaseMulti

func ReleaseMulti(ctx context.Context, tList []*Throttle) error

Types

type Throttle

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

func New

func New(count int) *Throttle

func (*Throttle) Acquire

func (t *Throttle) Acquire(ctx context.Context) error

func (*Throttle) Release

func (t *Throttle) Release(ctx context.Context) error

func (*Throttle) TryAcquire

func (t *Throttle) TryAcquire(ctx context.Context) (bool, error)

Jump to

Keyboard shortcuts

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