Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: share inotify fd across watchers #26200

Merged
merged 7 commits into from
Oct 23, 2024

Conversation

littledivy
Copy link
Member

@littledivy littledivy commented Oct 13, 2024

Fixes #26104
Fixes #26071
Fixes #17757

@littledivy littledivy added the ci-draft Run the CI on draft PRs. label Oct 13, 2024
@littledivy littledivy marked this pull request as ready for review October 19, 2024 18:13
@littledivy littledivy removed the ci-draft Run the CI on draft PRs. label Oct 19, 2024
Comment on lines +136 to +139
event.paths.iter().any(|event_path| {
same_file::is_same_file(event_path, path).unwrap_or(false)
|| starts_with_canonicalized(event_path, path)
})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we be smarter here? Iterating over all paths specified for each watcher can be costly. Maybe a hash set would work better here to try and match file path directly?

Copy link
Member Author

@littledivy littledivy Oct 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two watchers can be watching the same file/directory so HashSet won't work.

That would work but won't be fast for most cases that require high file watchers (recursive) because we need to fallback when paths are inside directory or symlinked.

@littledivy littledivy merged commit be969cb into denoland:main Oct 23, 2024
17 checks passed
@littledivy littledivy deleted the share_inotify_fd branch October 23, 2024 03:53
bartlomieju pushed a commit that referenced this pull request Oct 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants