Appearance
concurrentPool() function
Ensures consistency in the level of concurrency based on the given number of concurrent tasks.
Signature:
typescript
declare function concurrentPool<A>(length: number, iterable: AsyncIterable<A>): AsyncIterableIterator<A>;Example
ts
await pipe(
[1, 2, 3, 4, 5, 6],
toAsync,
map((a) => delay(100 * a, a)),
concurrentPool(3),
each(console.log), // log 1, 2, 3, 4, 5, 6
); // 0.9 seconds