Move the EventKind::Access
filtering before the loop starts (#27569)
Follow up #27498 Release Notes: - N/A
This commit is contained in:
parent
a7697be857
commit
926d10cc45
1 changed files with 8 additions and 4 deletions
|
@ -38,9 +38,6 @@ impl Watcher for FsWatcher {
|
||||||
EventKind::Create(_) => Some(PathEventKind::Created),
|
EventKind::Create(_) => Some(PathEventKind::Created),
|
||||||
EventKind::Modify(_) => Some(PathEventKind::Changed),
|
EventKind::Modify(_) => Some(PathEventKind::Changed),
|
||||||
EventKind::Remove(_) => Some(PathEventKind::Removed),
|
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,
|
_ => None,
|
||||||
};
|
};
|
||||||
let mut path_events = event
|
let mut path_events = event
|
||||||
|
@ -108,7 +105,14 @@ static FS_WATCHER_INSTANCE: OnceLock<anyhow::Result<GlobalWatcher, notify::Error
|
||||||
OnceLock::new();
|
OnceLock::new();
|
||||||
|
|
||||||
fn handle_event(event: Result<notify::Event, notify::Error>) {
|
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| {
|
global::<()>(move |watcher| {
|
||||||
for f in watcher.watchers.lock().iter() {
|
for f in watcher.watchers.lock().iter() {
|
||||||
f(&event)
|
f(&event)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue