limiter

package module
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2020 License: MIT Imports: 3 Imported by: 0

README

concurrency-limiter

Documentation

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
}

func NewLimiter

func NewLimiter(limit int) *Limiter

func (*Limiter) Finish

func (l *Limiter) Finish()

Finish will remove the goroutine from the waiting list and sends a signal to the waiting goroutine to access the resource

func (*Limiter) Wait

func (l *Limiter) Wait()

Wait method waits if the number of concurrent requests is more than the limit specified. If a timeout is configured , then the goroutine will wait until the timeout occurs and then proceeds to access the resource irrespective of whether it has received a signal in the done channel.

func (*Limiter) WithTimeout

func (l *Limiter) WithTimeout(timeout int) *Limiter

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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