Make backup wait for the server refresh and fail when it fails (closes #99)
check / check (push) Successful in 1m8s
check / check (push) Successful in 1m8s
lib.backup() refreshed through the background loop's refresh, which returns at once when one is already running and swallows a failure, so a backup could run on the previous file list, or on an empty cache, and exit 0. It now uses the refresh fresh() uses: it joins a running refresh or starts one, and rejects before touching any file when it fails. The CLI's error wrapper prints that as one line and exits 1. Model: opus-5-5
This commit was merged in pull request #122.
This commit is contained in:
@@ -538,11 +538,13 @@ export class Library {
|
||||
}
|
||||
|
||||
// Back up every in-scope file to `downloadDirectory` in the historical
|
||||
// on-disk layout, with a durable failure ledger (issue #51). Refreshes
|
||||
// first, fetches pending originals (and optional thumbnails) through the
|
||||
// content cache and pools, then rebuilds the derived symlink/JSON views
|
||||
// from the model. Throws before any network work when no download directory
|
||||
// is available or no content cache backs the originals it must fetch.
|
||||
// on-disk layout, with a durable failure ledger (issue #51). Waits for a
|
||||
// completed refresh first, as `fresh()` does, joining one already running,
|
||||
// and rejects before touching any file when it fails. Then fetches pending
|
||||
// originals (and optional thumbnails) through the content cache and pools,
|
||||
// and rebuilds the derived symlink/JSON views from the model. Throws before
|
||||
// any network work when no download directory is available or no content
|
||||
// cache backs the originals it must fetch.
|
||||
backup(opts?: BackupOptions): Promise<BackupResult> {
|
||||
const downloadDirectory =
|
||||
opts?.downloadDirectory ?? this.downloadDirectory;
|
||||
@@ -566,7 +568,7 @@ export class Library {
|
||||
const cache = this.cache;
|
||||
return runBackup(
|
||||
{
|
||||
refresh: () => this.runRefresh(),
|
||||
refresh: () => this.refreshNow(),
|
||||
listCollections: () => this.store.listCollections(),
|
||||
listFiles: (id) => this.store.listFiles(id),
|
||||
original: (fileID) => cache!.original(fileID),
|
||||
|
||||
Reference in New Issue
Block a user