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

Method shutdown

packages/effect/src/internal/pubsub.ts:972–992  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

970 }
971
972 get shutdown(): Effect.Effect<void> {
973 return core.uninterruptible(
974 core.withFiberRuntime<void>((state) => {
975 MutableRef.set(this.shutdownFlag, true)
976 return pipe(
977 fiberRuntime.forEachParUnbounded(
978 unsafePollAllQueue(this.pollers),
979 (d) => core.deferredInterruptWith(d, state.id()),
980 false
981 ),
982 core.zipRight(core.sync(() => {
983 this.subscribers.delete(this.subscription)
984 this.subscription.unsubscribe()
985 this.strategy.unsafeOnPubSubEmptySpace(this.pubsub, this.subscribers)
986 })),
987 core.whenEffect(core.deferredSucceed(this.shutdownHook, void 0)),
988 core.asVoid
989 )
990 })
991 )
992 }
993
994 get isShutdown(): Effect.Effect<boolean> {
995 return core.sync(() => MutableRef.get(this.shutdownFlag))

Callers

nothing calls this directly

Calls 7

unsafePollAllQueueFunction · 0.85
syncMethod · 0.80
pipeFunction · 0.70
setMethod · 0.65
idMethod · 0.65
unsubscribeMethod · 0.65

Tested by

no test coverage detected