Skip to content

concurrentPool() function

주어진 동시 작업 수를 기반으로 동시성 수준의 일관성을 보장합니다.

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

Open Source Code

Released under the Apache-2.0 License.