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

Function offer

packages/effect/src/unstable/sql/SqlStream.ts:51–68  ·  view source on GitHub ↗
(arr: ReadonlyArray<A>)

Source from the content-addressed store, hash-verified

49
50 let paused = false
51 const offer = (arr: ReadonlyArray<A>) => {
52 if (arr.length === 0) return
53 const isFull = Queue.isFullUnsafe(queue)
54 if (!isFull || (isFull && paused)) {
55 return Effect.runFork(Queue.offerAll(queue, arr))
56 }
57 paused = true
58 cbs.onPause()
59 return Queue.offerAll(queue, arr).pipe(
60 Effect.tap(() =>
61 Effect.sync(() => {
62 cbs.onResume()
63 paused = false
64 })
65 ),
66 Effect.runFork
67 )
68 }
69
70 return Effect.map(
71 register({

Callers 2

asyncPauseResumeFunction · 0.70
PersistedQueue.tsFile · 0.50

Calls 3

offerAllMethod · 0.80
pipeMethod · 0.65
syncMethod · 0.45

Tested by

no test coverage detected