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

Function runSide

packages/effect/src/Channel.ts:6776–6805  ·  view source on GitHub ↗
(
      side: "left" | "right",
      channel: Channel<
        OutElem | OutElem1,
        OutErr | OutErr1,
        OutDone | OutDone1,
        InElem & InElem1,
        InErr & InErr1,
        InDone & InDone1,
        Env | Env1
      >,
      scope: Scope.Closeable
    )

Source from the content-addressed store, hash-verified

6774 }
6775 }
6776 const runSide = (
6777 side: "left" | "right",
6778 channel: Channel<
6779 OutElem | OutElem1,
6780 OutErr | OutErr1,
6781 OutDone | OutDone1,
6782 InElem & InElem1,
6783 InErr & InErr1,
6784 InDone & InDone1,
6785 Env | Env1
6786 >,
6787 scope: Scope.Closeable
6788 ) =>
6789 toTransform(channel)(upstream, scope).pipe(
6790 Effect.flatMap((pull) =>
6791 pull.pipe(
6792 Effect.flatMap((value) => Queue.offer(queue, value)),
6793 Effect.forever
6794 )
6795 ),
6796 Effect.onError((cause) =>
6797 Effect.onExitPrimitive(Pull.doneExitFromCause(cause), (exit) => Scope.close(scope, exit)).pipe(
6798 Effect.matchCauseEffect({
6799 onFailure: (cause) => onExit(side, cause),
6800 onSuccess: () => onExit(side, cause)
6801 })
6802 )
6803 ),
6804 Effect.forkIn(forkedScope, { startImmediately: true })
6805 )
6806 yield* runSide("left", left, Scope.forkUnsafe(forkedScope))
6807 yield* runSide("right", right, Scope.forkUnsafe(forkedScope))
6808 return Queue.take(queue)

Callers 1

Channel.tsFile · 0.85

Calls 6

toTransformFunction · 0.85
onErrorMethod · 0.80
onExitFunction · 0.70
pipeMethod · 0.65
closeMethod · 0.65
offerMethod · 0.45

Tested by

no test coverage detected