Public: anyone can read this; the crew can change it.
Sentinel: queue:check is past its budget: 1 check waits for 8 slots, 5 busy; the oldest since 04:18; the longest running is #17213 at 46 min (limit 60). #17376
Merged 36h 15m ago, live in production
mason/forge:mason/17373-sentinel-queue-check-is-past-its-budget → main 0 commits fork
2 files
changed +20
−6
src/checks/red_main.ts +8 −6
| @@ -20,6 +20,7 @@ | ||
| 20 | 20 | import type { Database } from "bun:sqlite"; |
| 21 | 21 | import type { Run } from "../core/runs.ts"; |
| 22 | 22 | import { checkLimitSentence } from "../settings/quotas.ts"; |
| 23 | import { BISECT_ENV, VERIFY_ENV } from "./verify.ts"; | |
| 23 | 24 | |
| 24 | 25 | export interface RedMain { |
| 25 | 26 | readonly repoId: string; |
| @@ -250,12 +251,12 @@ export function laneSince( | ||
| 250 | 251 | |
| 251 | 252 | /** |
| 252 | 253 | * The queued checks no red main holds (startable now): how many, and the |
| 253 | * oldest one's `laneSince`. A held check's age says nothing about the lane, | |
| 254 | * and nor does the time a released one spent held. Those their own | |
| 255 | * account's concurrent-checks limit holds (`checkLimitSentence`, the rule the | |
| 256 | * scheduler keeps them queued by) wait for it, not the lane: counted apart in | |
| 257 | * `byAccount`, and never the oldest. One query for the queue, then the limit | |
| 258 | * asked once per distinct owner, never per check. | |
| 254 | * oldest one's `laneSince`. The verification lane's are left out: it runs one at a time beside | |
| 255 | * the slots, so a verification behind another waits for that lane, not a slot (#17373). A held | |
| 256 | * check's age says nothing about the lane, and nor does the time a released one spent held. Those | |
| 257 | * their own account's concurrent-checks limit holds (`checkLimitSentence`, the rule the scheduler | |
| 258 | * keeps them queued by) wait for it, not the lane: counted apart in `byAccount`, and never the | |
| 259 | * oldest. One query for the queue, then the limit asked once per distinct owner, never per check. | |
| 259 | 260 | */ |
| 260 | 261 | export function freeChecks( |
| 261 | 262 | db: Database, |
| @@ -276,6 +277,7 @@ export function freeChecks( | ||
| 276 | 277 | LEFT JOIN run last ON last.id = ${mainBefore("")} |
| 277 | 278 | LEFT JOIN run prev ON prev.id = ${mainBefore("AND r.id < last.id")} |
| 278 | 279 | WHERE q.state = 'queued' AND q.kind = 'check' |
| 280 | AND q.env NOT IN ('${VERIFY_ENV}', '${BISECT_ENV}') | |
| 279 | 281 | AND (q.not_before IS NULL OR q.not_before <= ?1) |
| 280 | 282 | AND NOT (q.issue_id IS NOT NULL AND q.reason <> '${ASKED}' |
| 281 | 283 | AND q.repo_id IN (SELECT value FROM json_each(?2)))`, |
test/account-held-lane.test.ts +12
| @@ -181,3 +181,15 @@ describe("the scheduler's hold and the lane's reading agree", () => { | ||
| 181 | 181 | expect(agree("u1", "r1")).toBe(true); |
| 182 | 182 | }); |
| 183 | 183 | }); |
| 184 | ||
| 185 | describe("verification waits are not the lane's wait (#17373)", () => { | |
| 186 | test("a verification queued behind another is no check waiting for a slot", () => { | |
| 187 | const v = createRun(db, { repoId: "r1", kind: "check", env: "verify" }); | |
| 188 | db.run("UPDATE run SET created_at = ?2 WHERE id = ?1", [v.id, ago(90)]); | |
| 189 | expect(freeChecks(db, [], Date.now()).n).toBe(0); | |
| 190 | queued("r1", 20); | |
| 191 | const free = freeChecks(db, [], Date.now()); | |
| 192 | expect(free.n).toBe(1); | |
| 193 | expect(Date.parse(free.oldest!)).toBeGreaterThan(Date.now() - 25 * 60_000); | |
| 194 | }); | |
| 195 | }); |
new above
offline