MCPcopy Create free account
hub / github.com/effect-app/libs / subscribe

Function subscribe

repos/effect/packages/effect/src/PubSub.ts:1092–1103  ·  view source on GitHub ↗
(self: PubSub<A>)

Source from the content-addressed store, hash-verified

1090const unsubscribe = <A>(self: Subscription<A>): Effect.Effect<void> =>
1091 Effect.uninterruptible(
1092 Effect.withFiber<void>((state) => {
1093 MutableRef.set(self.shutdownFlag, true)
1094 return Effect.forEach(
1095 MutableList.takeAll(self.pollers),
1096 (d) => Deferred.interruptWith(d, state.id),
1097 { discard: true, concurrency: "unbounded" }
1098 ).pipe(
1099 Effect.tap(() =>
1100 Effect.sync(() => {
1101 self.subscribers.delete(self.subscription)
1102 self.subscription.unsubscribe()
1103 self.replayWindow.close()
1104 self.strategy.onPubSubEmptySpaceUnsafe(self.pubsub, self.subscribers)
1105 })
1106 ),

Callers

nothing calls this directly

Calls 6

makeSubscriptionUnsafeFunction · 0.85
unsubscribeFunction · 0.85
addFinalizerMethod · 0.80
closeMethod · 0.80
getMethod · 0.65
pipeMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…