Time out condition after 200ms and add basic unit tests for it

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
Antonio Scandurra
2021-04-20 17:21:29 +02:00
co-authored by Nathan Sobo
parent cd7dccd30c
commit 37444acc9c
3 changed files with 171 additions and 24 deletions
+3 -3
View File
@@ -77,9 +77,9 @@ impl Worktree {
pub fn scan_complete(&self) -> impl Future<Output = ()> {
let mut scan_state_rx = self.scan_state.1.clone();
async move {
let mut next_scan_state = Some(scan_state_rx.borrow().clone());
while let Some(ScanState::Scanning) = next_scan_state {
next_scan_state = scan_state_rx.recv().await;
let mut scan_state = Some(scan_state_rx.borrow().clone());
while let Some(ScanState::Scanning) = scan_state {
scan_state = scan_state_rx.recv().await;
}
}
}