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
Parameter | Type |
---|---|
pool | number | ConcurrencyPool |
fn | (...params: Args ) => Promise <Return > |
Returns
Function
(...args:
Args
):Promise
<Return
>Parameters
Parameter Type ...args Args
Returns
Promise
<Return
>