MCPcopy Create free account
hub / github.com/ZenNotes/zennotes / waitForHttpOk

Function waitForHttpOk

tooling/scripts/perf-web-runtime.mjs:171–184  ·  view source on GitHub ↗
(url, timeoutMs)

Source from the content-addressed store, hash-verified

169}
170
171async function waitForHttpOk(url, timeoutMs) {
172 const deadline = Date.now() + timeoutMs
173 let lastError = null
174 while (Date.now() < deadline) {
175 try {
176 await httpGetJson(url)
177 return
178 } catch (err) {
179 lastError = err
180 await sleep(100)
181 }
182 }
183 throw new Error(`Timed out waiting for ${url}: ${lastError?.message ?? 'unknown error'}`)
184}
185
186function formatIndex(index) {
187 return String(index).padStart(5, '0')

Callers 1

mainFunction · 0.85

Calls 2

httpGetJsonFunction · 0.70
sleepFunction · 0.70

Tested by

no test coverage detected