From d232150d679e43c82cd9c4f23d4e2a226bf7ec5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E5=B0=8F=E7=99=BD?= <364772080@qq.com> Date: Wed, 26 Mar 2025 23:20:09 +0800 Subject: [PATCH] windows: Fix performance issues after trashing or deleting a folder (#27498) Closes #25247 Since the upstream `Notify` repo hasn't merged the related PR yet, this is basically a temporary patch to work around it. Release Notes: - N/A --- Cargo.lock | 61 +++++++++++++------------------------ crates/fs/Cargo.toml | 2 +- crates/fs/src/fs_watcher.rs | 3 ++ 3 files changed, 25 insertions(+), 41 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a515cedcd82b34cbd4c5d449678fed1b0d1efafa..76be4214b0db385b240b40af3b57c0e4abb121c7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5228,7 +5228,7 @@ dependencies = [ "ignore", "libc", "log", - "notify 6.1.1", + "notify 8.0.0 (git+https://github.com/zed-industries/notify.git?rev=bbb9ea5ae52b253e095737847e367c30653a2e96)", "objc", "parking_lot", "paths", @@ -6833,17 +6833,6 @@ dependencies = [ "zeta", ] -[[package]] -name = "inotify" -version = "0.9.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8069d3ec154eb856955c1c0fbffefbf5f3c40a104ec912d4797314c1801abff" -dependencies = [ - "bitflags 1.3.2", - "inotify-sys", - "libc", -] - [[package]] name = "inotify" version = "0.11.0" @@ -6949,7 +6938,7 @@ dependencies = [ "fnv", "lazy_static", "libc", - "mio 1.0.3", + "mio", "rand 0.8.5", "serde", "tempfile", @@ -8151,7 +8140,7 @@ dependencies = [ "ignore", "log", "memchr", - "notify 8.0.0", + "notify 8.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "notify-debouncer-mini", "once_cell", "opener", @@ -8300,18 +8289,6 @@ version = "0.5.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e53debba6bda7a793e5f99b8dacf19e626084f525f7829104ba9898f367d85ff" -[[package]] -name = "mio" -version = "0.8.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4a650543ca06a924e8b371db273b2756685faae30f8487da1b56505a8f78b0c" -dependencies = [ - "libc", - "log", - "wasi 0.11.0+wasi-snapshot-preview1", - "windows-sys 0.48.0", -] - [[package]] name = "mio" version = "1.0.3" @@ -8591,38 +8568,37 @@ dependencies = [ [[package]] name = "notify" -version = "6.1.1" +version = "8.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6205bd8bb1e454ad2e27422015fb5e4f2bcc7e08fa8f27058670d208324a4d2d" +checksum = "2fee8403b3d66ac7b26aee6e40a897d85dc5ce26f44da36b8b73e987cc52e943" dependencies = [ "bitflags 2.8.0", - "crossbeam-channel", "filetime", "fsevent-sys 4.1.0", - "inotify 0.9.6", + "inotify", "kqueue", "libc", "log", - "mio 0.8.11", + "mio", + "notify-types 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "walkdir", - "windows-sys 0.48.0", + "windows-sys 0.59.0", ] [[package]] name = "notify" version = "8.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fee8403b3d66ac7b26aee6e40a897d85dc5ce26f44da36b8b73e987cc52e943" +source = "git+https://github.com/zed-industries/notify.git?rev=bbb9ea5ae52b253e095737847e367c30653a2e96#bbb9ea5ae52b253e095737847e367c30653a2e96" dependencies = [ "bitflags 2.8.0", "filetime", "fsevent-sys 4.1.0", - "inotify 0.11.0", + "inotify", "kqueue", "libc", "log", - "mio 1.0.3", - "notify-types", + "mio", + "notify-types 2.0.0 (git+https://github.com/zed-industries/notify.git?rev=bbb9ea5ae52b253e095737847e367c30653a2e96)", "walkdir", "windows-sys 0.59.0", ] @@ -8634,8 +8610,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a689eb4262184d9a1727f9087cd03883ea716682ab03ed24efec57d7716dccb8" dependencies = [ "log", - "notify 8.0.0", - "notify-types", + "notify 8.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "notify-types 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "tempfile", ] @@ -8645,6 +8621,11 @@ version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5e0826a989adedc2a244799e823aece04662b66609d96af8dff7ac6df9a8925d" +[[package]] +name = "notify-types" +version = "2.0.0" +source = "git+https://github.com/zed-industries/notify.git?rev=bbb9ea5ae52b253e095737847e367c30653a2e96#bbb9ea5ae52b253e095737847e367c30653a2e96" + [[package]] name = "ntapi" version = "0.4.1" @@ -14241,7 +14222,7 @@ dependencies = [ "backtrace", "bytes 1.10.1", "libc", - "mio 1.0.3", + "mio", "parking_lot", "pin-project-lite", "signal-hook-registry", diff --git a/crates/fs/Cargo.toml b/crates/fs/Cargo.toml index eb86c4067c02fe196962de6ce116be096e59232d..5adb964c60436d0f830461655ea1cc9ec186ab9c 100644 --- a/crates/fs/Cargo.toml +++ b/crates/fs/Cargo.toml @@ -40,7 +40,7 @@ objc = "0.2" cocoa = "0.26" [target.'cfg(not(target_os = "macos"))'.dependencies] -notify = "6.1.1" +notify = { git = "https://github.com/zed-industries/notify.git", rev = "bbb9ea5ae52b253e095737847e367c30653a2e96" } [target.'cfg(target_os = "windows")'.dependencies] windows.workspace = true diff --git a/crates/fs/src/fs_watcher.rs b/crates/fs/src/fs_watcher.rs index 2ef5547afda0a4e2216dd824387bdd2516206d20..e010d16062c129d8914ce575efb07d1e2cdef2a5 100644 --- a/crates/fs/src/fs_watcher.rs +++ b/crates/fs/src/fs_watcher.rs @@ -38,6 +38,9 @@ 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