@scalequality/check 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/check.mjs +7 -1
- package/package.json +1 -1
package/bin/check.mjs
CHANGED
|
@@ -94,10 +94,16 @@ async function main() {
|
|
|
94
94
|
if (!runId) fail("no run id returned.")
|
|
95
95
|
log(`ScaleQuality: measuring ${project} …`)
|
|
96
96
|
|
|
97
|
+
// The poll interval is part of the measured gate time, not just politeness. A flat
|
|
98
|
+
// 5s quantizes every verdict to a 5s boundary: an analysis that finishes in 7s is
|
|
99
|
+
// only reported at 10s, and the pipeline pays 3s of pure waiting. Start tight and
|
|
100
|
+
// back off, so a fast repo answers fast and a slow one still polls cheaply.
|
|
101
|
+
const POLL_MS = [1500, 1500, 2000, 2000, 3000]
|
|
97
102
|
const deadline = Date.now() + timeoutMs
|
|
98
103
|
let last
|
|
104
|
+
let poll = 0
|
|
99
105
|
while (Date.now() < deadline) {
|
|
100
|
-
await sleep(
|
|
106
|
+
await sleep(POLL_MS[Math.min(poll++, POLL_MS.length - 1)])
|
|
101
107
|
const sr = await fetch(`${base}/report/${runId}`, { headers: auth }).catch((e) => fail(`status check failed (${e.message})`))
|
|
102
108
|
if (!sr.ok) { const b = await sr.text().catch(() => ""); fail(`status failed (${sr.status}) ${b}`) }
|
|
103
109
|
last = await sr.json()
|
package/package.json
CHANGED