mirror of
https://github.com/zed-industries/zed.git
synced 2026-07-09 16:00:35 +00:00
fs: Retry watch registrations skipped during the native watch-limit cooldown (#60662)
GlobalWatcher::add returns Ok(None) while the native watch-limit cooldown is active, and FsWatcher::add_existing_path treated that as success: the path was never watched, with no retry and no error. A long-lived watch (like a repository's git directory) that happened to register during a cooldown window silently never received events. Route the skipped registration through the existing pending-path machinery, which already polls until registration succeeds and emits a rescan event for the path so that changes missed in the interim are picked up. --- Release Notes: - N/A or Added/Fixed/Improved ...
This commit is contained in:
parent
8230cb16d1
commit
e2d41c477c
1 changed files with 12 additions and 3 deletions
|
|
@ -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(())
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue