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

Function takeAll

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

Source from the content-addressed store, hash-verified

1206 } else if (!Arr.isArrayNonEmpty(as)) {
1207 return Effect.flatMap(pollForItem(self), (item) => loop([item]))
1208 }
1209 return Effect.succeed(as)
1210 })
1211
1212const pollForItem = <A>(self: Subscription<A>) => {
1213 const deferred = Deferred.makeUnsafe<A>()
1214 let set = self.subscribers.get(self.subscription)
1215 if (!set) {
1216 set = new Set()
1217 self.subscribers.set(self.subscription, set)
1218 }
1219 set.add(self.pollers)
1220 MutableList.append(self.pollers, deferred)
1221 self.strategy.completePollersUnsafe(
1222 self.pubsub,
1223 self.subscribers,
1224 self.subscription,
1225 self.pollers
1226 )
1227 return Effect.onInterrupt(
1228 Deferred.await(deferred),
1229 () => {

Callers

nothing calls this directly

Calls 6

pollForItemFunction · 0.85
loopFunction · 0.70
pollUpToMethod · 0.65
takeAllMethod · 0.65
succeedMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…