Skip to content

limitConcurrency() ​

Function

limitConcurrency<Args, Return>(pool: number | ConcurrencyPool, fn: Function): Function

Ensures only pool instances of the provided function is running.

In case a ConcurrencyPool is passed, then only as many instances will run as there are free tokens. This mean if the pool is also used somewhere else, then more instances of the function will start running when the pool has available tokens again.

Source: packages/concurrency-utils/src/lib/limit-concurrency.ts:11

Type parameters ​

Parameter
Args extends unknown[]
Return

Parameters ​

ParameterType
poolnumber | ConcurrencyPool
fn(...params: Args) => Promise<Return>

Returns ​

Function

(...args: Args): Promise<Return>

Parameters ​

ParameterType
...argsArgs

Returns ​

Promise<Return>