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

Function waitForServer

test/cache-interceptor/cache-tests-worker.mjs:98–111  ·  view source on GitHub ↗

* @param {string} baseUrl * @returns {Promise }

(baseUrl)

Source from the content-addressed store, hash-verified

96 * @returns {Promise<void>}
97 */
98async function waitForServer (baseUrl) {
99 const { hostname, port, protocol } = new URL(baseUrl)
100 const deadline = Date.now() + 30_000
101
102 while (Date.now() < deadline) {
103 if (await canConnect(hostname, Number(port), protocol)) {
104 return
105 }
106
107 await sleep(250)
108 }
109
110 throw new Error(`cache test server did not start listening at ${baseUrl}`)
111}
112
113/**
114 * @param {string} host

Callers 1

Calls 2

canConnectFunction · 0.85
sleepFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…