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

Method sleepMillis

packages/effect/src/internal/effect.ts:6008–6018  ·  view source on GitHub ↗
(millis: number)

Source from the content-addressed store, hash-verified

6006 return this.sleepMillis(Duration.toMillis(duration))
6007 }
6008 private sleepMillis(millis: number): Effect.Effect<void> {
6009 if (millis <= 0) return yieldNow
6010 else if (!Number.isFinite(millis)) return never
6011 return callback((resume) => {
6012 const continuation = millis > MAX_TIMER_MILLIS
6013 ? this.sleepMillis(millis - MAX_TIMER_MILLIS)
6014 : void_
6015 const handle = setTimeout(() => resume(continuation), Math.min(millis, MAX_TIMER_MILLIS))
6016 return sync(() => clearTimeout(handle))
6017 })
6018 }
6019}
6020
6021const nanosPerMilli = BigInt(1_000_000)

Callers 1

sleepMethod · 0.95

Calls 3

callbackFunction · 0.70
resumeFunction · 0.50
syncFunction · 0.50

Tested by

no test coverage detected