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

Function matchConcurrency

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

Source from the content-addressed store, hash-verified

2792
2793/** @internal */
2794export const matchConcurrency = <A>(
2795 concurrency: number | "unbounded" | undefined,
2796 sequential: () => A,
2797 bounded: (n: number) => A
2798) => {
2799 switch (concurrency) {
2800 case undefined:
2801 return sequential()
2802 case "unbounded":
2803 return bounded(Number.MAX_SAFE_INTEGER)
2804 default:
2805 return concurrency > 1 ? bounded(concurrency) : sequential()
2806 }
2807}
2808
2809const flatMapParSwitchBuffer = dual<
2810 <A, A2, E2, R2>(

Callers 1

stream.tsFile · 0.85

Calls 2

sequentialFunction · 0.70
boundedFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…