limitAsync es-toolkit
Creates a new function that limits the maximum number of concurrent executions of an async function.
Reference
limitAsync(callback, concurrency)
Use limitAsync when you want to limit the number of concurrent executions of an async function that gets called multiple times. Only the specified number of executions run concurrently, and additional calls wait until running operations complete.
It's useful for controlling load on resource-intensive operations like external API calls or database queries. It's especially effective when working with rate-limited APIs or managing server load.
Parameters
The async function to limit concurrent executions for.
Maximum number of concurrent operations.
Returns
A new function with concurrency limiting applied. It has the same interface as the original function.
Source: es-toolkit
Re-exported verbatim from es-toolkit. Implementation, edge cases, and performance behavior are owned upstream. This page mirrors the documentation at the pinned version; the linked source is authoritative.