MCPcopy Index your code
hub / github.com/Effect-TS/effect / finalizersMaskInternal

Function finalizersMaskInternal

packages/effect/src/internal/fiberRuntime.ts:2826–2855  ·  view source on GitHub ↗
(strategy: ExecutionStrategy.ExecutionStrategy, concurrentFinalizers?: boolean | undefined)

Source from the content-addressed store, hash-verified

2824/* @internal */
2825export const finalizersMaskInternal =
2826 (strategy: ExecutionStrategy.ExecutionStrategy, concurrentFinalizers?: boolean | undefined) =>
2827 <A, E, R>(
2828 self: (
2829 restore: <A1, E1, R1>(self: Effect.Effect<A1, E1, R1>) => Effect.Effect<A1, E1, R1>
2830 ) => Effect.Effect<A, E, R>
2831 ): Effect.Effect<A, E, R> =>
2832 core.contextWithEffect((context) =>
2833 Option.match(Context.getOption(context, scopeTag), {
2834 onNone: () => self(identity),
2835 onSome: (scope) => {
2836 if (concurrentFinalizers === true) {
2837 const patch = strategy._tag === "Parallel"
2838 ? parallelFinalizers
2839 : strategy._tag === "Sequential"
2840 ? sequentialFinalizers
2841 : parallelNFinalizers(strategy.parallelism)
2842 switch (scope.strategy._tag) {
2843 case "Parallel":
2844 return patch(self(parallelFinalizers))
2845 case "Sequential":
2846 return patch(self(sequentialFinalizers))
2847 case "ParallelN":
2848 return patch(self(parallelNFinalizers(scope.strategy.parallelism)))
2849 }
2850 } else {
2851 return self(identity)
2852 }
2853 }
2854 })
2855 )
2856
2857/* @internal */
2858export const scopeWith = <A, E, R>(

Callers 2

fiberRuntime.tsFile · 0.85
finalizersMaskFunction · 0.85

Calls 3

parallelNFinalizersFunction · 0.85
getOptionMethod · 0.65
patchFunction · 0.50

Tested by

no test coverage detected