A backup whose lock is lost stops with one line, not a stack trace (closes #184)
check / check (push) Canceled after 0s
check / check (push) Canceled after 0s
proper-lockfile's default onCompromised throws from a timer, so a backup whose backup.lock was removed or taken over by another backup died with a stack trace. lockBackupDirectory now returns the lock, its release function and why it was lost, and passes a handler that only records the reason. The backup checks it after the refresh and before each original, thumbnail, file's JSON and album, and before it writes failures.json, and then fails with "lost the lock on DIR: REASON", which quak backup prints as one line, exiting 1. lib.backup() takes a caller's lock as lock, in place of lockHeld: true. Releasing a lost lock leaves backup.lock alone, since it may be another backup's. Model: opus-5-5
This commit was merged in pull request #193.
This commit is contained in:
@@ -96,6 +96,7 @@ import { runBackup, type BackupOptions, type BackupResult } from "../backup.js";
|
||||
export {
|
||||
lockBackupDirectory,
|
||||
runBackup,
|
||||
type BackupLock,
|
||||
type BackupOptions,
|
||||
type BackupResult,
|
||||
type BackupError,
|
||||
@@ -570,9 +571,10 @@ export class Library {
|
||||
|
||||
// Back up every in-scope file to `opts.downloadDirectory`, or else the
|
||||
// library's, each original at its save path, with a durable failure
|
||||
// ledger (issue #51). Takes the lock in that directory first, unless
|
||||
// `opts.lockHeld` says the caller holds it, failing at once while another
|
||||
// backup of it runs (see `runBackup`). Waits for a
|
||||
// ledger (issue #51). Takes the lock in that directory first, unless the
|
||||
// caller passes the lock it took as `opts.lock`, failing at once while
|
||||
// another backup of it runs, and before it starts another file once the
|
||||
// lock is lost (see `lockBackupDirectory`). Waits for a
|
||||
// completed refresh, as `fresh()` does, joining one already running, and
|
||||
// rejects before touching any file but the lock when it fails. Then puts
|
||||
// pending originals at their save paths as `Photo.download()` does (and
|
||||
|
||||
Reference in New Issue
Block a user