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

The cancelled result is never used, but scan_files still checked each listed file's cached probe against the file.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Nathaniel Ledford
2026-10-21 13:17:05 -04:00
co-authored by Claude Opus 5.5
parent d1d3dbbb0e
commit fd7fbe59e4
+5
View File
@@ -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")]