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

Function awaitPendingTransaction

packages/effect/src/Effect.ts:14579–14598  ·  view source on GitHub ↗
(state: Transaction["Service"])

Source from the content-addressed store, hash-verified

14577}
14578
14579const awaitPendingTransaction = (state: Transaction["Service"]) =>
14580 suspend(() => {
14581 const key = {}
14582 const refs = Array.from(state.journal.keys())
14583 const clearPending = () => {
14584 for (const clear of refs) {
14585 clear.pending.delete(key)
14586 }
14587 }
14588 return callback<void>((resume) => {
14589 const onCall = () => {
14590 clearPending()
14591 resume(void_)
14592 }
14593 for (const ref of refs) {
14594 ref.pending.set(key, onCall)
14595 }
14596 return sync(clearPending)
14597 })
14598 })
14599
14600function commitTransaction(fiber: Fiber<unknown, unknown>, state: Transaction["Service"]) {
14601 for (const [ref, { value }] of state.journal) {

Callers 1

txFunction · 0.85

Calls 4

suspendFunction · 0.70
callbackFunction · 0.70
syncFunction · 0.70
setMethod · 0.65

Tested by

no test coverage detected