Documentation
¶
Overview ¶
Package plimit provides a faithful port of the npm p-limit library: it runs an unbounded number of scheduled functions while capping the number that execute concurrently.
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 runs scheduled functions with a bounded level of concurrency.
func New ¶
New creates a Limiter that allows at most concurrency functions to run at the same time. A concurrency of 1 or less serializes execution.
func (*Limiter) ActiveCount ¶
ActiveCount returns the number of functions currently executing.
func (*Limiter) Go ¶
func (l *Limiter) Go(fn func())
Go schedules fn to run. It never blocks the caller: the function is queued and starts as soon as a concurrency slot becomes available. Use Wait to block until all scheduled functions have completed.
func (*Limiter) PendingCount ¶
PendingCount returns the number of functions scheduled but not yet started.