mirror of
https://github.com/storytold/lightcraft.git
synced 2026-10-24 10:09:01 -06:00
Synchronize Folder: progress reaches its end; say what still writes on the UI thread (review fixes)
The relink check counted only the photos still to relink, so when some moved files were gone again the bar stopped short of its total. The module docs now name the writes that stay on the UI thread after each step (the durable save; auto-written sidecars), and a test that only showed the work checks files again is named for that. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
47dfdd3c0e
commit
8233d1e412
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user