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

Function edgePass

packages/effect/src/ui/Query.ts:7325–7344  ·  view source on GitHub ↗
(trigger: "visibility" | "connectivity")

Source from the content-addressed store, hash-verified

7323 // -- host signals -----------------------------------------------------------
7324 /** One synchronous pass over watched entries, on a false-to-true edge with both signals then true. */
7325 const edgePass = (trigger: "visibility" | "connectivity"): void => {
7326 for (const entry of allEntries()) {
7327 if (entry.watchers.size === 0) continue
7328 if (entry.fetch !== undefined) {
7329 if (entry.fetch.append && (isStale(entry) || intervalElapsed(entry))) {
7330 entry.owed ??= trigger
7331 }
7332 continue
7333 }
7334 if (isStale(entry) || intervalElapsed(entry)) {
7335 const build = survivingBuild(entry)
7336 if (build !== undefined) ensureFetch(entry, trigger, build)
7337 } else if (
7338 entry.intervalDue !== undefined && entry.intervalCancel === undefined
7339 ) {
7340 // Not due yet: it sleeps for the remainder.
7341 armInterval(entry)
7342 }
7343 }
7344 }
7345 const listen = (
7346 signal: Signal,
7347 trigger: "visibility" | "connectivity"

Callers 1

listenFunction · 0.85

Calls 6

allEntriesFunction · 0.85
intervalElapsedFunction · 0.85
survivingBuildFunction · 0.85
ensureFetchFunction · 0.85
armIntervalFunction · 0.85
isStaleFunction · 0.70

Tested by

no test coverage detected