Write each backed-up original once and skip the precache (closes #106)
check / check (push) Successful in 49s

An original fetched for a backup is now written by the download writer
straight into the backup's originals/, and the content cache records it
there instead of keeping its own copy. One the cache already held is
still copied. `quak backup` opens its library with the thumbnail and
originals precache off, as the one-shot commands do.

Model: opus-5-5
This commit was merged in pull request #124.
This commit is contained in:
2026-09-23 08:48:02 +02:00
parent f52c77f155
commit ae76eb3f74
8 changed files with 109 additions and 30 deletions
+11
View File
@@ -13,6 +13,7 @@
import {
existsSync,
mkdtempSync,
readdirSync,
readFileSync,
rmSync,
statSync,
@@ -427,6 +428,16 @@ describe("backup", () => {
expect(stdout.text).toBe("");
});
// The backup opens its library with the precache off: it fetches the
// originals it needs into the backup, and must not also fetch every
// thumbnail in the account, or keep originals, in the per-user cache.
it("leaves nothing in the cache's originals and thumbnails", async () => {
const dir = join(root, "backup");
expect(await backupCommand(context(), dir, {})).toBe(0);
expect(readdirSync(join(root, "cache", "thumbnails"))).toEqual([]);
expect(readdirSync(join(root, "cache", "originals"))).toEqual([]);
});
it("exits 1 and lists the file when one download fails", async () => {
const ctx = context(fakeClient({ failID: 101 }));
expect(await backupCommand(ctx, join(root, "backup"), {})).toBe(1);