-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
only use recursive watchers on macOS and windows #4100
only use recursive watchers on macOS and windows #4100
Conversation
fallback to non-recursively watch read directories on other OS
The latest updates on your projects. Learn more about Vercel for Git ↗︎
8 Ignored Deployments
|
|
Benchmark for e2a9b99
Click to view full benchmark
|
Benchmark for 01255ab
Click to view full benchmark
|
@@ -29,7 +29,7 @@ use std::{ | |||
path::{Path, PathBuf, MAIN_SEPARATOR}, | |||
sync::{ | |||
mpsc::{channel, RecvError, TryRecvError}, | |||
Arc, Mutex, | |||
Arc, Mutex, MutexGuard, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MutexGuard
is unused on Mac/Windows, giving a clippy warning.
#[cfg(not(any(target_os = "macos", target_os = "windows")))] | ||
fn restore_if_watching(&self, dir_path: &Path, root_path: &Path) -> Result<()> { | ||
if self.watching.contains(dir_path) { | ||
let mut watcher = self.watcher.lock().unwrap(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have a lock that's only used inside a loop. If we passed the HashSet
to this method, we could lock once and iterate
let disk_watcher = self.watcher.clone(); | ||
let root_path = self.root_path().to_path_buf(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto unused. Could we make a consistent interface between Mac and Linux so we can just make calls to empty methods?
#[cfg(not(any(target_os = "macos", target_os = "windows")))] | ||
batched_new_paths.insert(path.clone()); | ||
} | ||
Ok(DebouncedEvent::Remove(path)) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to remove a from the DiskWatcher
in this case?
This reverts commit c0bb681.
### Description Only windows and macOS support real recursive file watchers, other OS emulate it by walking the directory structure and watching all directories. But that might be really slow and use up a lot of watchers, so we don't want that. Instead we know exactly which directories are used and can watch selectively directories when they are accessed. * only use recursive watchers on macOS and windows * fallback to non-recursively watch read directories on other OS Note that this implementation still has some bugs when renaming folders, but we can probably figure out these edge cases later...
## Bugfixes - vercel/turborepo#3526 - vercel/turborepo#4084 - vercel/turborepo#4083 - vercel/turborepo#4067 - vercel/turborepo#3959 - vercel/turborepo#4060 - vercel/turborepo#4081 - vercel/turborepo#4103 - vercel/turborepo#4100 - vercel/turborepo#4108 - vercel/turborepo#4101 - vercel/turborepo#4112 - vercel/turborepo#3956 - vercel/turborepo#4118 - vercel/turborepo#4117 ## Feature - vercel/turborepo#4058 - vercel/turborepo#4013 - vercel/turborepo#4005 - vercel/turborepo#4001 - vercel/turborepo#3839 - vercel/turborepo#4017 - vercel/turborepo#4086 - vercel/turborepo#4067 ## Performance - vercel/turborepo#4040 - vercel/turborepo#4110 ## Refactor - vercel/turborepo#4098
### Description Only windows and macOS support real recursive file watchers, other OS emulate it by walking the directory structure and watching all directories. But that might be really slow and use up a lot of watchers, so we don't want that. Instead we know exactly which directories are used and can watch selectively directories when they are accessed. * only use recursive watchers on macOS and windows * fallback to non-recursively watch read directories on other OS Note that this implementation still has some bugs when renaming folders, but we can probably figure out these edge cases later...
### Description Only windows and macOS support real recursive file watchers, other OS emulate it by walking the directory structure and watching all directories. But that might be really slow and use up a lot of watchers, so we don't want that. Instead we know exactly which directories are used and can watch selectively directories when they are accessed. * only use recursive watchers on macOS and windows * fallback to non-recursively watch read directories on other OS Note that this implementation still has some bugs when renaming folders, but we can probably figure out these edge cases later...
### Description Only windows and macOS support real recursive file watchers, other OS emulate it by walking the directory structure and watching all directories. But that might be really slow and use up a lot of watchers, so we don't want that. Instead we know exactly which directories are used and can watch selectively directories when they are accessed. * only use recursive watchers on macOS and windows * fallback to non-recursively watch read directories on other OS Note that this implementation still has some bugs when renaming folders, but we can probably figure out these edge cases later...
Description
Only windows and macOS support real recursive file watchers, other OS emulate it by walking the directory structure and watching all directories. But that might be really slow and use up a lot of watchers, so we don't want that. Instead we know exactly which directories are used and can watch selectively directories when they are accessed.
Note that this implementation still has some bugs when renaming folders, but we can probably figure out these edge cases later...