mirror of
https://github.com/colbymchenry/codegraph.git
synced 2026-10-17 05:07:37 +08:00
test(ui-server): time the busiest symbol as the best of five requests (#2208)
`answers in under 100 ms` took one wall-clock sample while the rest of the suite ran in parallel, and failed under that load at 250-430 ms (three times in one day of full-suite runs) while passing alone. It now takes the fastest of five warm requests: contention is gone from at least one, and a real slowdown is slow on every one. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1093,9 +1093,16 @@ describe.runIf(CodeGraph.isInitialized(path.resolve(__dirname, '..')))(
|
||||
|
||||
await repoGet(`/api/node/${hit.id}`); // warm
|
||||
|
||||
const started = performance.now();
|
||||
const res = await repoGet(`/api/node/${hit.id}`);
|
||||
const elapsed = performance.now() - started;
|
||||
// The fastest of a few requests: one sample, taken while the rest of the
|
||||
// suite runs in parallel, measured the machine's load (250–430 ms) as
|
||||
// often as the endpoint. A real slowdown is slow on every request.
|
||||
let res!: Response;
|
||||
let elapsed = Infinity;
|
||||
for (let i = 0; i < 5; i++) {
|
||||
const started = performance.now();
|
||||
res = await repoGet(`/api/node/${hit.id}`);
|
||||
elapsed = Math.min(elapsed, performance.now() - started);
|
||||
}
|
||||
|
||||
expect(res.status).toBe(200);
|
||||
const body = JSON.parse(res.body);
|
||||
|
||||
Reference in New Issue
Block a user