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
This commit is contained in:
张小白 2025-03-26 23:20:09 +08:00 committed by GitHub
parent 9a2dfa687d
commit d232150d67
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 36 additions and 52 deletions

83
Cargo.lock generated
View file

@ -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"
@ -8589,25 +8566,6 @@ dependencies = [
"workspace",
]
[[package]]
name = "notify"
version = "6.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6205bd8bb1e454ad2e27422015fb5e4f2bcc7e08fa8f27058670d208324a4d2d"
dependencies = [
"bitflags 2.8.0",
"crossbeam-channel",
"filetime",
"fsevent-sys 4.1.0",
"inotify 0.9.6",
"kqueue",
"libc",
"log",
"mio 0.8.11",
"walkdir",
"windows-sys 0.48.0",
]
[[package]]
name = "notify"
version = "8.0.0"
@ -8617,12 +8575,30 @@ 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 (registry+https://github.com/rust-lang/crates.io-index)",
"walkdir",
"windows-sys 0.59.0",
]
[[package]]
name = "notify"
version = "8.0.0"
source = "git+https://github.com/zed-industries/notify.git?rev=bbb9ea5ae52b253e095737847e367c30653a2e96#bbb9ea5ae52b253e095737847e367c30653a2e96"
dependencies = [
"bitflags 2.8.0",
"filetime",
"fsevent-sys 4.1.0",
"inotify",
"kqueue",
"libc",
"log",
"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",

View file

@ -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

View file

@ -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