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

Method handleSurplus

packages/effect/src/internal/pubsub.ts:1421–1441  ·  view source on GitHub ↗
(
    pubsub: AtomicPubSub<A>,
    subscribers: Subscribers<A>,
    elements: Iterable<A>,
    isShutdown: MutableRef.MutableRef<boolean>
  )

Source from the content-addressed store, hash-verified

1419 }
1420
1421 handleSurplus(
1422 pubsub: AtomicPubSub<A>,
1423 subscribers: Subscribers<A>,
1424 elements: Iterable<A>,
1425 isShutdown: MutableRef.MutableRef<boolean>
1426 ): Effect.Effect<boolean> {
1427 return core.withFiberRuntime((state) => {
1428 const deferred = core.deferredUnsafeMake<boolean>(state.id())
1429 return pipe(
1430 core.suspend(() => {
1431 this.unsafeOffer(elements, deferred)
1432 this.unsafeOnPubSubEmptySpace(pubsub, subscribers)
1433 this.unsafeCompleteSubscribers(pubsub, subscribers)
1434 return MutableRef.get(isShutdown) ?
1435 core.interrupt :
1436 core.deferredAwait(deferred)
1437 }),
1438 core.onInterrupt(() => core.sync(() => this.unsafeRemove(deferred)))
1439 )
1440 })
1441 }
1442
1443 unsafeOnPubSubEmptySpace(
1444 pubsub: AtomicPubSub<A>,

Callers

nothing calls this directly

Calls 8

unsafeOfferMethod · 0.95
unsafeRemoveMethod · 0.95
syncMethod · 0.80
pipeFunction · 0.70
idMethod · 0.65
getMethod · 0.65

Tested by

no test coverage detected