LightCraft: An open-source non-destructive photo editor written by scratch in pure Rust
Synchronize Folder: progress reaches its end; say what still writes on the UI thread (review fixes)
Nathaniel Ledford8233d1e4126d
diff --git a/crates/engine/src/sync.rs b/crates/engine/src/sync.rsindex b876aef89..126cac37c 100644--- a/crates/engine/src/sync.rs+++ b/crates/engine/src/sync.rs@@ -16,7 +16,9 @@//! [`synchronize`] then imports the new files (in place), relinks the moved photos, moves the//! missing photos to Recently Deleted and reads the metadata updates — each only when chosen — as//! one undo step. It runs in halves ([`SyncJob`]) so that, in the app, every file it reads is-//! read on a worker thread and only the catalog changes happen on the UI thread.+//! read on a worker thread and only the catalog changes happen on the UI thread — with what every+//! command does after them there: the library's durable save and, with XMP auto-write on, the+//! sidecars of the photos whose metadata was read.//!//! The scan runs without the session ([`SyncInput`] + [`scan_with`]), so the app can run it on a//! worker thread: a folder on a sleeping network share must never stall a frame.@@ -572,9 +574,10 @@ impl SyncWork {return;}// still where the scan found it, and still gone from where the photo says+ let checked = moved.len();let relink: Vec<(PhotoId, String)> =moved.into_iter().filter(|m| Path::new(&m.to).is_file() && !Path::new(&m.from).exists()).map(|m| (PhotoId(m.id), m.to)).collect();- step(relink.len());+ step(checked);if !relink.is_empty() && !send(SyncStep::Relink(relink)) {return;}diff --git a/crates/engine/src/tests_sync.rs b/crates/engine/src/tests_sync.rsindex b5601e714..22dce0af8 100644--- a/crates/engine/src/tests_sync.rs+++ b/crates/engine/src/tests_sync.rs@@ -498,7 +498,7 @@ fn the_work_of_synchronizing_runs_apart_from_its_commits() {}#[test]-fn readying_a_synchronize_reads_no_file() {+fn the_work_checks_again_that_a_new_file_is_still_there() {let dir = Scratch::new("ready");let mut s = library(&dir);write_png(&dir.path("trip/c.png"), 3);