Documentation ¶
Index ¶
Constants ¶
View Source
const ( StrategyLeak = 1 // Removes the first (oldest) element in queue and adds the new one StrategyOverflow = 2 // The added element will be lost. )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Reservoir ¶
type Reservoir struct { MaxConcurrent int // How many requests can be running at the same time. Default: 0 (unlimited) MinTime time.Duration // How long to wait after launching a request before launching another one. Default: 0ms MaxQueueLength int OverflowStrategy int Queue []job // contains filtered or unexported fields }
func NewReservoir ¶
Create a new reservoir struct and start working the queue
func (*Reservoir) Add ¶
func (rv *Reservoir) Add(fn interface{}, args ...interface{})
Add a new call to the queue
func (*Reservoir) LimitQueue ¶
Set the queue limit and the strategy whats happens if queue is full
Click to show internal directories.
Click to hide internal directories.