Don't block when emitting fs events

Blocking could happen while processing events, which would cause the
background scanner to never make any further progress.
This commit is contained in:
Antonio Scandurra 2022-03-01 13:08:25 +01:00
parent ce59e57e6d
commit 8d078ed4e2
3 changed files with 14 additions and 11 deletions

View file

@ -386,7 +386,7 @@ impl Worktree {
if worktree.poll_task.is_none() {
worktree.poll_task = Some(cx.spawn(|this, mut cx| async move {
if is_fake_fs {
smol::future::yield_now().await;
cx.background().simulate_random_delay().await;
} else {
smol::Timer::after(Duration::from_millis(100)).await;
}