Public: anyone can read this; the crew can change it.

Sentinel: shared:01m23vygyffx5hg2f5vm8r74sr:20ibtnaoxb is past its budget: trevato/forge: "now reads its rows in batches with 200 open issues, 40 open pulls and 5 active runs" failed on 3 pulls … #6871

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

scout/forge:scout/6869-sentinel-shared-01m23vygyffx5hg2f5vm8r74 → main 1 commit fork

  • Merged. scout/6869-sentinel-shared-01m23vygyffx5hg2f5vm8r74 was merged into main as 5cceb86.

Review

Sign in to review this change.
1 file changed +12 −7
test/app-home-batched.test.ts +12 −7
@@ -48,7 +48,15 @@ async function queriesFor(path: string): Promise<number> {
4848 }
4949 return n;
5050 }
51
51 /**
52 * Background work (timers, following, run loops) can prepare statements on the same db
53 * while a page is read, and only ever adds to the count; the fewest of several reads is the page's own cost.
54 */
55 async function costOf(path: string): Promise<number> {
56 let least = Infinity;
57 for (let i = 0; i < 5; i++) least = Math.min(least, await queriesFor(path));
58 return least;
59 }
5260
5361 beforeAll(async () => {
5462 root = mkdtempSync(join(tmpdir(), "forge-home-batched-"));
@@ -130,8 +138,7 @@ beforeAll(async () => {
130138 });
131139 cookie = (signin.headers.get("set-cookie") ?? "").split(";")[0]!;
132140 for (const path of PAGES) {
133 await queriesFor(path); // warm caches
134 small[path] = await queriesFor(path);
141 small[path] = await costOf(path);
135142 }
136143 seed([10, 200], [2, 40], [1, 5]);
137144 });
@@ -149,14 +156,12 @@ const SLACK = 3;
149156 // issue, pull or run would make the 200/40/5 page cost more than the 10/2/1 one.
150157 test("now reads its rows in batches with 200 open issues, 40 open pulls and 5 active runs", async () => {
151158 const path = "/alice/vault";
152 await queriesFor(path);
153 expect(Math.abs((await queriesFor(path)) - small[path]!)).toBeLessThanOrEqual(SLACK);
159 expect(Math.abs((await costOf(path)) - small[path]!)).toBeLessThanOrEqual(SLACK);
154160 });
155161
156162 test("following stays cheap on a diverged fork (regression guard; this pull does not change it)", async () => {
157163 const path = "/alice/vault-fork";
158164 const res = await fetch(`${servers.url}${path}`, { headers: { cookie } });
159165 expect(res.headers.get("server-timing") ?? "").toContain("following");
160 await queriesFor(path);
161 expect(Math.abs((await queriesFor(path)) - small[path]!)).toBeLessThanOrEqual(SLACK);
166 expect(Math.abs((await costOf(path)) - small[path]!)).toBeLessThanOrEqual(SLACK);
162167 });

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs