Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

fs: Retry watch registrations skipped during the native watch-limit cooldown (#60662)

Lukas Wirthe2d41c477c82
diff --git a/crates/fs/src/fs_watcher.rs b/crates/fs/src/fs_watcher.rs
index 016d4ca20f3..99664ae7480 100644
--- a/crates/fs/src/fs_watcher.rs
+++ b/crates/fs/src/fs_watcher.rs
@@ -56,13 +56,22 @@ impl FsWatcher {
log::trace!("path to watch is already watched: {path:?}");
return Ok(());
}
- if let Some(registration) = register_existing_path(
- path,
+ match register_existing_path(
+ path.clone(),
case_insensitive,
self.tx.clone(),
self.pending_path_events.clone(),
)? {
- self.registrations.lock().insert(key, registration);
+ Some(registration) => {
+ self.registrations.lock().insert(key, registration);
+ }
+ None => {
+ // Registration was skipped (e.g. the native watch-limit cooldown
+ // is active). Retry in the background rather than silently leaving
+ // the path unwatched forever.
+ log::warn!("watch registration for {path:?} was skipped; retrying in background");
+ self.add_pending_path(path);
+ }
}
Ok(())
}