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

Function onFetchExit

packages/effect/src/ui/Query.ts:6057–6084  ·  view source on GitHub ↗
(
    entry: Entry,
    fetch: FetchRec,
    exit: Exit.Exit<any, any>
  )

Source from the content-addressed store, hash-verified

6055 afterQuiet(entry)
6056 }
6057 const onFetchExit = (
6058 entry: Entry,
6059 fetch: FetchRec,
6060 exit: Exit.Exit<any, any>
6061 ): void => {
6062 if (disposed) return
6063 // Stream failures settle like fetch failures; the stream body handles completion.
6064 if (entry.live === fetch) entry.live = undefined
6065 else if (entry.fetch !== fetch) return
6066 entry.kept = false
6067 if (entry.def.list !== undefined) {
6068 return entry.def.list.ops.onWalkExit(cacheEnv(), entry, fetch, exit)
6069 }
6070 entry.fetch = undefined
6071 let defect: Cause.Cause<never> | undefined
6072 let stored = false
6073 if (exit._tag === "Success") {
6074 store(entry, AsyncResult.success(exit.value, { timestamp: now() }))
6075 stored = true
6076 } else if (Cause.hasDies(exit.cause)) {
6077 defect = markDefect(entry, exit.cause)
6078 } else if (Cause.hasFails(exit.cause)) {
6079 stored = storeFailure(entry, failsOnly(exit.cause))
6080 }
6081 // Otherwise interrupted, such as by the fetcher itself: a revert, never a Failure.
6082 resumeAll(entry.waiters, callerExit(exit))
6083 afterFetch(entry, stored, defect)
6084 }
6085 /**
6086 * Interrupts the fetch and restarts it with its trigger, under a surviving build or else its own, which is all
6087 * a prefetch has. With no open build the entry reverts.

Callers 1

startFetchFunction · 0.85

Calls 9

cacheEnvFunction · 0.85
markDefectFunction · 0.85
storeFailureFunction · 0.85
failsOnlyFunction · 0.85
resumeAllFunction · 0.85
callerExitFunction · 0.85
afterFetchFunction · 0.85
storeFunction · 0.70
nowFunction · 0.70

Tested by

no test coverage detected