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

Function checkDone

packages/effect/src/internal/fiberRuntime.ts:3741–3764  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

3739 core.async<void, E>((cb) => {
3740 const counts = entries.map((_) => _.listeners.count)
3741 const checkDone = () => {
3742 if (counts.every((count) => count === 0)) {
3743 if (
3744 entries.every((_) => {
3745 if (_.result.state.current._tag === "Pending") {
3746 return true
3747 } else if (
3748 _.result.state.current._tag === "Done" &&
3749 core.exitIsExit(_.result.state.current.effect) &&
3750 _.result.state.current.effect._tag === "Failure" &&
3751 internalCause.isInterrupted(_.result.state.current.effect.cause)
3752 ) {
3753 return true
3754 } else {
3755 return false
3756 }
3757 })
3758 ) {
3759 cleanup.forEach((f) => f())
3760 onInterrupt?.()
3761 cb(core.interruptFiber(processing))
3762 }
3763 }
3764 }
3765 processing.addObserver((exit) => {
3766 cleanup.forEach((f) => f())
3767 cb(exit)

Callers 2

observerFunction · 0.85
invokeWithInterruptFunction · 0.85

Calls 2

isInterruptedMethod · 0.80
fFunction · 0.50

Tested by

no test coverage detected