Skip to content

pause scanning to wait for deletion - #435

Draft
Byron wants to merge 3 commits into
mainfrom
pause-scanning
Draft

Byron wants to merge 3 commits into
mainfrom
pause-scanning

Conversation

@Byron

@Byron Byron commented Nov 16, 2026 •

Copy link
Copy Markdown
Owner

If deletion should happen early, pause scans so deletion has all the resources, and so that it works for dua-clean as well.

Inspired by #433, which I thought deserves a complete implementation even if it's bigger.

Tasks

This reverts commit 534bf82.

Remove the queued-deletion implementation before replaying the pause-scanning
stack onto the updated main base. The stack pauses traversal to delete
immediately, replacing the wait-for-scan behavior.
Interactive deletion needs filesystem workers to stop before removing
paths, then resume their queued work without rescanning the whole input.
Cleanup discovery and sizing must be able to share the same pause state.

Add controlled walk constructors and status reporting. Pausing stops new
jobs while active jobs finish, retaining the pool and its buffered output.
Excluding confirmed removal paths skips queued jobs, metadata lookups, and
buffered entries beneath them when traversal resumes. Cancellation and
pool drop wake threads waiting at pause checkpoints.

Validation: all dua-core tests and Clippy pass. Regressions cover pause and
resume with one and four workers, zero-capacity output, removed subtrees,
and dropping a paused walk.
Deleting during traversal races queued directory reads and can restore
removed entries or count their failures as scan errors. Waiting for the
whole scan to finish also prevents immediate removal of cleanup candidates.

Pause ordinary traversal and cleanup discovery/sizing, drain published
events, then run deletion and resume the remaining jobs. Exclude confirmed
removal paths even when they have no tree node, and clear removed indices
before the tree reuses their slots. Freeze mark edits during the handoff
and release the pause on cancellation or failure.

Ordinary scans may still hold incomplete subtree sizes, so deletion and
Trash reports use unknown totals in that case. Sized cleanup candidates
retain their totals; snapshot export scans still block deletion.

Validation: all workspace tests, feature checks, stateless CLI journeys,
and formatting pass. New journeys cover one and four threads in ordinary
and cleanup scans, partial deletion, late errors, and cancellation with
full output queues. Clippy passes with the pre-existing needless_bool
lint allowed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants