Skip to content

armgit / peel

Public Imported from GitHub
0

Uninstall Mac apps with every file they leave behind, and see why each belongs. Free up space, fine-tune macOS, and set up Terminal.

Duplicates shows a stopped scan stopped at once

Țugui Dragoș6e98bd91b731
diff --git a/Peel/Model/DuplicateLibrary.swift b/Peel/Model/DuplicateLibrary.swift
index 7b4239fa..b6ee88a8 100644
--- a/Peel/Model/DuplicateLibrary.swift
+++ b/Peel/Model/DuplicateLibrary.swift
@@ -106,8 +106,13 @@ final class DuplicateLibrary {
scanTask = Task { await runScan(current) }
}
+ /// Shows the scan stopped at once, as the other pages do. The scan itself ends a moment later, or once a read
+ /// stuck on a network share returns, and what it found is dropped by its `generation`.
func stop() {
scanTask?.cancel()
+ generation += 1
+ progress = nil
+ isScanning = false
}
func clearResults() {
@@ -146,6 +151,8 @@ final class DuplicateLibrary {
let (updates, continuation) = AsyncStream.makeStream(of: DuplicateScanProgress.self, bufferingPolicy: .bufferingNewest(1))
let progressUpdates = Task {
for await update in updates {
+ // A scan stopped or replaced reports on until it notices, over the newer scan's progress otherwise.
+ guard current == generation else { break }
if case .collecting = update {
isOnFiles = true
}