Skip to content

LightCraft: An open-source non-destructive photo editor written by scratch in pure Rust

LRC-LIB-LIBFOLDERS: a scan cancelled during its listing asks the disk nothing more

Nathaniel Ledfordfd7fbe59e474
diff --git a/crates/engine/src/sync.rs b/crates/engine/src/sync.rs
index 6f641fa22..713c697a7 100644
--- a/crates/engine/src/sync.rs
+++ b/crates/engine/src/sync.rs
@@ -242,6 +242,11 @@ pub fn scan_with(input: SyncInput, progress: &SyncProgress) -> FolderChanges {
}),
);
progress.listed.store(true, std::sync::atomic::Ordering::Release);
+ // ✕ during the listing: its result is not used, so nothing more is asked of the disk (the files' cached probes
+ // would each be checked against the file, a round trip per file on a network share)
+ if progress.files.cancel.load(std::sync::atomic::Ordering::Relaxed) {
+ return FolderChanges { path: folder, seen, ..Default::default() };
+ }
let listing = &listing;
// (no threads on the web: one after the other there)
#[cfg(target_arch = "wasm32")]