MCPcopy
hub / github.com/nodejs/undici / waitFor

Function waitFor

test/http2-dispatcher.js:699–708  ·  view source on GitHub ↗
(fn)

Source from the content-addressed store, hash-verified

697 let abortRequest = null
698
699 const waitFor = async (fn) => {
700 for (let i = 0; i < 100; i++) {
701 const value = fn()
702 if (value != null) {
703 return value
704 }
705 await sleep(10)
706 }
707 throw new Error('timed out waiting for h2 request stream')
708 }
709
710 const responseError = new Promise(resolve => {
711 client.dispatch({

Callers 1

Calls 2

fnFunction · 0.70
sleepFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…