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

Function parallelNFinalizers

packages/effect/src/internal/fiberRuntime.ts:2810–2824  ·  view source on GitHub ↗
(parallelism: number)

Source from the content-addressed store, hash-verified

2808/* @internal */
2809export const parallelNFinalizers =
2810 (parallelism: number) => <A, E, R>(self: Effect.Effect<A, E, R>): Effect.Effect<A, E, R> =>
2811 core.contextWithEffect((context) =>
2812 Option.match(Context.getOption(context, scopeTag), {
2813 onNone: () => self,
2814 onSome: (scope) => {
2815 if (scope.strategy._tag === "ParallelN" && scope.strategy.parallelism === parallelism) {
2816 return self
2817 }
2818 return core.flatMap(
2819 core.scopeFork(scope, ExecutionStrategy.parallelN(parallelism)),
2820 (inner) => scopeExtend(self, inner)
2821 )
2822 }
2823 })
2824 )
2825
2826/* @internal */
2827export const finalizersMask = (strategy: ExecutionStrategy.ExecutionStrategy) =>

Callers 1

finalizersMaskInternalFunction · 0.85

Calls 1

getOptionMethod · 0.65

Tested by

no test coverage detected