MCPcopy Create free account
hub / github.com/Effect-TS/effect / matchConcurrency

Function matchConcurrency

packages/effect/src/internal/stream.ts:2787–2800  ·  view source on GitHub ↗
(
  concurrency: number | "unbounded" | undefined,
  sequential: () => A,
  bounded: (n: number) => A
)

Source from the content-addressed store, hash-verified

2785
2786/** @internal */
2787export const matchConcurrency = <A>(
2788 concurrency: number | "unbounded" | undefined,
2789 sequential: () => A,
2790 bounded: (n: number) => A
2791) => {
2792 switch (concurrency) {
2793 case undefined:
2794 return sequential()
2795 case "unbounded":
2796 return bounded(Number.MAX_SAFE_INTEGER)
2797 default:
2798 return concurrency > 1 ? bounded(concurrency) : sequential()
2799 }
2800}
2801
2802const flatMapParSwitchBuffer = dual<
2803 <A, A2, E2, R2>(

Callers 1

stream.tsFile · 0.85

Calls 2

sequentialFunction · 0.70
boundedFunction · 0.70

Tested by

no test coverage detected