Method: run(fn)
Executes an asynchronous function within the concurrency queue.
Parameters:
fn– An async function (or function returning a promise) to execute.
Returns:
A promise resolving to the result of fn.
Behavior:
- If the number of currently running operations is below
limit,fnexecutes immediately. - If the limit is reached, the function waits in a queue until a slot is available.
- After
fnfinishes, the next function in the queue starts automatically.