From b6f43ba45b1fbac5b0146887deb5f3e2caa4e9fb Mon Sep 17 00:00:00 2001 From: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com> Date: Wed, 26 Nov 2025 18:33:31 +0100 Subject: [PATCH] Worker pool is no longer scoped --- crates/project/src/project_search.rs | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/crates/project/src/project_search.rs b/crates/project/src/project_search.rs index c56bd925dd..55cc6472b9 100644 --- a/crates/project/src/project_search.rs +++ b/crates/project/src/project_search.rs @@ -297,24 +297,22 @@ impl Search { }; let should_find_all_matches = !tx.is_closed(); + let num_cpus = executor.num_cpus(); - let worker_pool = executor.scoped(|scope| { - let num_cpus = executor.num_cpus(); - - assert!(num_cpus > 0); - for _ in 0..executor.num_cpus() - 1 { + assert!(num_cpus > 0); + let worker_pool = (0..num_cpus - 1) + .map(|_| { let worker = Worker { query: query.clone(), open_buffers: open_buffers.clone(), candidates: candidate_searcher.clone(), find_all_matches_rx: find_all_matches_rx.clone(), }; - scope.spawn(worker.run()); - } - - drop(find_all_matches_rx); - drop(candidate_searcher); - }); + executor.spawn(worker.run()).boxed_local() + }) + .collect::>(); + drop(find_all_matches_rx); + drop(candidate_searcher); let (sorted_matches_tx, sorted_matches_rx) = unbounded(); // The caller of `into_handle` decides whether they're interested in all matches (files that matched + all matching ranges) or @@ -349,7 +347,7 @@ impl Search { }; futures::future::join_all( - [worker_pool.boxed_local()] + worker_pool .into_iter() .chain(buffer_snapshots) .chain(ensure_matches_are_reported_in_order)