Check the lock before every file, and pass the lock itself to the backup
check / check (push) Canceled after 0s

The backup now checks its lock after the refresh and before each file of
the thumbnail, JSON and album passes, as well as before each original and
before failures.json. lockBackupDirectory returns the lock, with release()
and lost, in place of a release function, and lib.backup() takes it as
lock in place of lockHeld: true; quak backup passes it. This drops the
process-wide map from directory path to lock, which missed a lock taken
through another path to the same directory.

Model: opus-5-5
This commit is contained in:
2026-10-14 05:09:55 +00:00
parent dc1f483a3d
commit 9c921e95dc
7 changed files with 87 additions and 75 deletions
+4 -3
View File
@@ -806,9 +806,10 @@ describe("a backup whose lock is lost", () => {
});
// A program can take the lock before it opens its library, as `quak
// backup` does. `lockBackupDirectory` returns the lock; the program passes
// it to `lib.backup()`, which checks it as it checks a lock it took, and
// releases it once the backup ends. The lock's `lost` says why it was lost.
// backup` does: `lockBackupDirectory` returns the lock, which the program
// passes to `lib.backup()` and releases once the backup ends. The backup
// checks it as it checks a lock it took, and the lock's `lost` says why it
// was lost.
it("rejects lib.backup() given its caller's lock once that lock is lost", async () => {
const lock = await lockBackupDirectory(dir);
const lib = await openLibrary();