Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
managed for small batch size edge case in semantic search
KCaverly5c48729c7c06
diff --git a/crates/semantic_index/src/semantic_index.rs b/crates/semantic_index/src/semantic_index.rsindex d2b69a03293..bd114de216a 100644--- a/crates/semantic_index/src/semantic_index.rs+++ b/crates/semantic_index/src/semantic_index.rs@@ -721,7 +721,12 @@ impl SemanticIndex {)?;let batch_n = cx.background().num_cpus();- let batch_size = file_ids.clone().len() / batch_n;+ let ids_len = file_ids.clone().len();+ let batch_size = if ids_len <= batch_n {+ ids_len+ } else {+ ids_len / batch_n+ };let mut result_tasks = Vec::new();for batch in file_ids.chunks(batch_size) {