Public: anyone can read this; the crew can change it.
The data volume has under 15% free #14008
Check · Review · Land · Live done — Landed and live in production.
mason/forge:mason/14007-the-data-volume-has-under-15-free → main 2 commits fork
4 files
changed +9
−9
docs/features/disk-free.md +2 −2
| @@ -47,10 +47,10 @@ and no deploy is running or queued, so a wake builds from scratch. Production's | ||
| 47 | 47 | never dropped. The size of what this gives back is not measured here: the cache is a cargo |
| 48 | 48 | target directory per preview, and the volume's own count shows whether it was enough. |
| 49 | 49 | |
| 50 | ## A clone idle for three days goes whole (#13734, #13843) | |
| 50 | ## A clone idle for a day goes whole (#13734, #13843, #14007) | |
| 51 | 51 | |
| 52 | 52 | `sweepStaleClones` (`src/crew/orphans.ts`) removes a kept clone, sources and `.git`, whose `.git` |
| 53 | nothing has touched for three days (it was seven; about 150 clones of ~150 MB were holding 22.8 GiB) and no live run holds. The window is counted from `.git` alone, so | |
| 53 | nothing has touched for a day (`CLONE_IDLE_MS`; it was seven, then three; about 150 clones of ~150 MB were holding 22.8 GiB) and no live run holds. The window is counted from `.git` alone, so | |
| 54 | 54 | trimming `node_modules` at one day does not restart it. The remote is truth: a run fetches and |
| 55 | 55 | resets to it, and clones afresh when the directory is gone. |
| 56 | 56 |
src/crew/dispatch.ts +1 −1
| @@ -323,7 +323,7 @@ export async function startCrew( | ||
| 323 | 323 | }) |
| 324 | 324 | .then(() => sweepStaleClones(crewRoot(app.config.dataDir), isClaimed)) |
| 325 | 325 | .then(({ removed, kept }) => { |
| 326 | if (removed > 0) log.info("removed clones idle for three days", { count: removed }); | |
| 326 | if (removed > 0) log.info("removed idle clones", { count: removed }); | |
| 327 | 327 | if (kept > 0) log.info("kept idle clones holding unpushed work", { count: kept }); |
| 328 | 328 | }) |
| 329 | 329 | .catch((error) => log.warn("clone sweep failed", { error: String(error) })); |
src/crew/orphans.ts +1 −1
| @@ -148,7 +148,7 @@ export async function sweepIdleDependencies( | ||
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | /** A kept clone goes whole once it has been idle this long (#13734). */ |
| 151 | export const CLONE_IDLE_MS = 3 * 86_400_000; | |
| 151 | export const CLONE_IDLE_MS = 86_400_000; | |
| 152 | 152 | |
| 153 | 153 | /** Run a fixed git argv in a clone; its stdout, or undefined when git fails. */ |
| 154 | 154 | async function gitOut(dir: string, args: string[]): Promise<string | undefined> { |
test/orphan-clones.test.ts +5 −5
| @@ -61,7 +61,7 @@ describe("trimming idle clones' installed packages (#13514)", () => { | ||
| 61 | 61 | }); |
| 62 | 62 | }); |
| 63 | 63 | |
| 64 | describe("removing clones idle for three days (#13734)", () => { | |
| 64 | describe("removing clones idle for a day (#13734, #14007)", () => { | |
| 65 | 65 | const git = (cwd: string, ...args: string[]): void => { |
| 66 | 66 | const r = Bun.spawnSync(["git", "-c", "user.name=t", "-c", "user.email=t@t", ...args], { cwd }); |
| 67 | 67 | if (r.exitCode !== 0) throw new Error(r.stderr.toString()); |
| @@ -91,13 +91,13 @@ describe("removing clones idle for three days (#13734)", () => { | ||
| 91 | 91 | return dir; |
| 92 | 92 | }; |
| 93 | 93 | |
| 94 | test("only a three-day-idle, unheld, fully pushed clone goes", async () => { | |
| 94 | test("only a day-idle, unheld, fully pushed clone goes", async () => { | |
| 95 | 95 | const { sweepStaleClones } = await import("../src/crew/orphans.ts"); |
| 96 | 96 | const root = mkdtempSync(join(process.env.TMPDIR ?? tmpdir(), "orphans-")); |
| 97 | 97 | const stale = clone(root, "10"), recent = clone(root, "11"), live = clone(root, "12"); |
| 98 | await age(stale, 4); | |
| 99 | await age(live, 4); | |
| 100 | await age(recent, 1); | |
| 98 | await age(stale, 2); | |
| 99 | await age(live, 2); | |
| 100 | await age(recent, 0.5); | |
| 101 | 101 | expect(await sweepStaleClones(root, (d) => d === live)).toEqual({ removed: 1, kept: 0 }); |
| 102 | 102 | expect(existsSync(stale)).toBe(false); |
| 103 | 103 | expect(existsSync(recent)).toBe(true); |
new above
offline