mirror of
https://github.com/zed-industries/zed.git
synced 2025-02-06 10:42:08 +00:00
Coalesce as many fs events as possible before processing them
This commit is contained in:
parent
b96962005e
commit
5df0a6a425
1 changed files with 7 additions and 1 deletions
|
@ -45,6 +45,7 @@ use std::{
|
||||||
os::unix::prelude::{OsStrExt, OsStringExt},
|
os::unix::prelude::{OsStrExt, OsStringExt},
|
||||||
path::{Path, PathBuf},
|
path::{Path, PathBuf},
|
||||||
sync::{atomic::AtomicUsize, Arc},
|
sync::{atomic::AtomicUsize, Arc},
|
||||||
|
task::Poll,
|
||||||
time::{Duration, SystemTime},
|
time::{Duration, SystemTime},
|
||||||
};
|
};
|
||||||
use sum_tree::{Bias, Edit, SeekTarget, SumTree, TreeMap};
|
use sum_tree::{Bias, Edit, SeekTarget, SumTree, TreeMap};
|
||||||
|
@ -2073,7 +2074,12 @@ impl BackgroundScanner {
|
||||||
}
|
}
|
||||||
|
|
||||||
futures::pin_mut!(events_rx);
|
futures::pin_mut!(events_rx);
|
||||||
while let Some(events) = events_rx.next().await {
|
|
||||||
|
while let Some(mut events) = events_rx.next().await {
|
||||||
|
while let Poll::Ready(Some(additional_events)) = futures::poll!(events_rx.next()) {
|
||||||
|
events.extend(additional_events);
|
||||||
|
}
|
||||||
|
|
||||||
if self.notify.unbounded_send(ScanState::Scanning).is_err() {
|
if self.notify.unbounded_send(ScanState::Scanning).is_err() {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue