Skip to content

fix(watcher): ignore events from files inside excluded directories - #325

Merged
gnacho merged 1 commit into
mainfrom
fix/watcher-excluded-dir-events
Nov 7, 2026
Merged

gnacho merged 1 commit into
mainfrom
fix/watcher-excluded-dir-events

Conversation

@gnacho

@gnacho gnacho commented Nov 7, 2026

Copy link
Copy Markdown
Owner

closes #324

Exclude patterns are name patterns, and classify_event only compared the basename of the event path. A pattern naming a directory hid that directory from the transfer but not its events. nextsync's own .nextsync/state.db sits inside every sync root, so each state write produced a Change, the scheduler ran a sync, the sync wrote the state database again, and the debounce gate (2 s quiet + 4 s cooldown) turned it into an endless loop at one run every ~6 s with zero transfers.

Now every component of the path below the watched root is matched against the patterns. Directory events keep passing, so an excluded folder is still watched.

Tests: cargo test --lib 708 passed, 0 failed (new excluded_directory_hides_its_children covers the state-database case and the same basename outside the excluded directory), cargo fmt --check and cargo clippy --lib clean.

classify_event compared only the basename against the exclude patterns, so
a pattern naming a directory hid the transfer of that directory but not its
events. nextsync's own .nextsync/state.db lives inside every sync root, so
each state write produced a Change, the scheduler ran a sync, the sync wrote
the state database again and the debounce gate kept the cycle going at one
run every ~6 s with no transfers.

Check every path component below the watched root instead.

Closes #324
@gnacho
gnacho merged commit bd15128 into main Nov 7, 2026
2 checks passed
@gnacho
gnacho deleted the fix/watcher-excluded-dir-events branch November 7, 2026 17:08
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.

Sync loop: watcher forwards events inside excluded directories, own .nextsync/state.db retriggers sync

1 participant