From f58ef25fc54c1a206f61e8806f10f29d70fd35fe Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Tue, 13 Jul 2021 12:32:10 +0200 Subject: [PATCH] Don't create a real background executor when `Fs` is fake --- zed/src/worktree.rs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/zed/src/worktree.rs b/zed/src/worktree.rs index afb6fc3e49..9642d49f14 100644 --- a/zed/src/worktree.rs +++ b/zed/src/worktree.rs @@ -550,14 +550,15 @@ impl Worktree { let (mut tree, scan_states_tx) = LocalWorktree::new(path, languages, fs.clone(), cx); let abs_path = tree.snapshot.abs_path.clone(); let background_snapshot = tree.background_snapshot.clone(); + let background = if fs.is_fake() { + cx.background().clone() + } else { + Arc::new(executor::Background::new()) + }; tree._background_scanner_task = Some(cx.background().spawn(async move { let events = fs.watch(&abs_path, Duration::from_millis(100)).await; - let scanner = BackgroundScanner::new( - background_snapshot, - scan_states_tx, - fs, - Arc::new(executor::Background::new()), - ); + let scanner = + BackgroundScanner::new(background_snapshot, scan_states_tx, fs, background); scanner.run(events).await; })); Worktree::Local(tree)