Repository navigation
fix(watcher): ignore events from files inside excluded directories - #325
Merged
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
closes #324
Exclude patterns are name patterns, and
classify_eventonly 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.dbsits inside every sync root, so each state write produced aChange, 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 --lib708 passed, 0 failed (newexcluded_directory_hides_its_childrencovers the state-database case and the same basename outside the excluded directory),cargo fmt --checkandcargo clippy --libclean.