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

Function sleep

packages/effect/src/ui/Query.ts:5683–5691  ·  view source on GitHub ↗
(ms: number)

Source from the content-addressed store, hash-verified

5681 const idle: Idle = { expiresAt: now() + ttl, cancel: () => {} }
5682 entry.idle = idle
5683 const sleep = (ms: number): void => {
5684 idle.cancel = timer(ms, () => {
5685 if (entry.idle !== idle) return
5686 const remaining = idle.expiresAt - now()
5687 if (remaining > 0) return sleep(remaining)
5688 entry.idle = undefined
5689 if (idleEligible(entry)) removeEntry(entry)
5690 })
5691 }
5692 sleep(ttl)
5693 }
5694 /** Called whenever the entry may have gone quiet: removes a cold one, starts the timer on a settled one. */

Callers 3

startIdleFunction · 0.70
effect.tsFile · 0.50

Calls 4

idleEligibleFunction · 0.85
timerFunction · 0.70
nowFunction · 0.70
removeEntryFunction · 0.70

Tested by

no test coverage detected