Public: anyone can read this; the crew can change it.
The data volume has under 15% free #13570
Check · Review · Land · Live done — Landed and live in production.
mason/forge:mason/13569-the-data-volume-has-under-15-free → main 1 commit fork
3 files
changed +24
−2
docs/features/disk-free.md +6
| @@ -22,3 +22,9 @@ The hourly clone sweep (`src/crew/dispatch.ts`) also removes `node_modules` from | ||
| 22 | 22 | an open issue or pull that nothing has touched for a day and no live run holds |
| 23 | 23 | (`sweepIdleDependencies`, `src/crew/orphans.ts`). It is about two thirds of a clone; sources and |
| 24 | 24 | `.git` stay, and `installDependencies` rebuilds it from the shared cache when a run resumes. |
| 25 | ||
| 26 | ## Run logs are kept a week (#13569) | |
| 27 | ||
| 28 | `runs/` held 15 GiB at the last count. `pruneRunFiles` (`src/runs/prune.ts`) now removes a run | |
| 29 | log or vitals file seven days after its last write, not fourteen; the run pages already say "no | |
| 30 | log" for a missing one. |
src/runs/prune.ts +1 −1
| @@ -10,7 +10,7 @@ import { join } from "node:path"; | ||
| 10 | 10 | import { runsRoot } from "./log.ts"; |
| 11 | 11 | |
| 12 | 12 | /** Logs and vitals are kept this long after their last write. */ |
| 13 | export const RUN_FILES_KEEP_MS = 14 * 86_400_000; | |
| 13 | export const RUN_FILES_KEEP_MS = 7 * 86_400_000; | |
| 14 | 14 | |
| 15 | 15 | /** Remove the regular files of `runs/` last written before `now - maxAgeMs`; how many went. */ |
| 16 | 16 | export function pruneRunFiles( |
test/run-prune.test.ts +17 −1
| @@ -3,7 +3,7 @@ import { existsSync, mkdirSync, mkdtempSync, utimesSync, writeFileSync } from "n | ||
| 3 | 3 | import { join } from "node:path"; |
| 4 | 4 | import { tmpdir } from "node:os"; |
| 5 | 5 | import { runsRoot } from "../src/runs/log.ts"; |
| 6 | import { pruneRunFiles } from "../src/runs/prune.ts"; | |
| 6 | import { pruneRunFiles, RUN_FILES_KEEP_MS } from "../src/runs/prune.ts"; | |
| 7 | 7 | |
| 8 | 8 | test("old run files go, recent ones stay", () => { |
| 9 | 9 | const dir = mkdtempSync(join(tmpdir(), "prune-")); |
| @@ -22,3 +22,19 @@ test("old run files go, recent ones stay", () => { | ||
| 22 | 22 | test("no runs directory is nothing to prune", () => { |
| 23 | 23 | expect(pruneRunFiles(mkdtempSync(join(tmpdir(), "prune-")))).toBe(0); |
| 24 | 24 | }); |
| 25 | ||
| 26 | test("a log is kept a week after its last write (#13569)", () => { | |
| 27 | expect(RUN_FILES_KEEP_MS).toBe(7 * 86_400_000); | |
| 28 | const dir = mkdtempSync(join(tmpdir(), "prune-")); | |
| 29 | mkdirSync(runsRoot(dir), { recursive: true }); | |
| 30 | const nine = join(runsRoot(dir), "nine.log"); | |
| 31 | const five = join(runsRoot(dir), "five.log"); | |
| 32 | writeFileSync(nine, "x"); | |
| 33 | writeFileSync(five, "x"); | |
| 34 | const at = (days: number) => new Date(Date.now() - days * 86_400_000); | |
| 35 | utimesSync(nine, at(9), at(9)); | |
| 36 | utimesSync(five, at(5), at(5)); | |
| 37 | expect(pruneRunFiles(dir)).toBe(1); | |
| 38 | expect(existsSync(nine)).toBe(false); | |
| 39 | expect(existsSync(five)).toBe(true); | |
| 40 | }); |
new above
offline