Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Move the `EventKind::Access` filtering before the loop starts (#27569)
张小白926d10cc4538
diff --git a/crates/fs/src/fs_watcher.rs b/crates/fs/src/fs_watcher.rsindex e010d16062c..b0e6a94b819 100644--- a/crates/fs/src/fs_watcher.rs+++ b/crates/fs/src/fs_watcher.rs@@ -38,9 +38,6 @@ impl Watcher for FsWatcher {EventKind::Create(_) => Some(PathEventKind::Created),EventKind::Modify(_) => Some(PathEventKind::Changed),EventKind::Remove(_) => Some(PathEventKind::Removed),- // Adding this fix a weird bug on Linux after upgrading notify- // https://github.com/zed-industries/zed/actions/runs/14085230504/job/39449448832- EventKind::Access(_) => return,_ => None,};let mut path_events = event@@ -108,7 +105,14 @@ static FS_WATCHER_INSTANCE: OnceLock<anyhow::Result<GlobalWatcher, notify::ErrorOnceLock::new();fn handle_event(event: Result<notify::Event, notify::Error>) {- let Some(event) = event.log_err() else { return };+ // Filter out access events, which could lead to a weird bug on Linux after upgrading notify+ // https://github.com/zed-industries/zed/actions/runs/14085230504/job/39449448832+ let Some(event) = event+ .log_err()+ .filter(|event| !matches!(event.kind, EventKind::Access(_)))+ else {+ return;+ };global::<()>(move |watcher| {for f in watcher.watchers.lock().iter() {f(&event)