refactor: remove runtime cfg!(test) check

Won't work in integration tests and consequently all threads would be
used. To remedy this we make explicit `max_threads=Some(1)` in the
IndexerConfig::default
This commit is contained in:
nnethercott 2025-05-13 09:12:34 +02:00
parent 75a7e40a27
commit 15cdc6924b
3 changed files with 12 additions and 33 deletions

View file

@ -33,9 +33,13 @@ impl Default for IndexerConfig {
#[allow(unused_mut)]
let mut pool_builder = ThreadPoolNoAbortBuilder::new();
#[allow(unused_mut, unused_assignments)]
let mut max_threads = None;
#[cfg(test)]
{
pool_builder = pool_builder.num_threads(1);
max_threads = Some(1);
}
let thread_pool = pool_builder
@ -44,16 +48,16 @@ impl Default for IndexerConfig {
.expect("failed to build default rayon thread pool");
Self {
max_threads,
thread_pool,
log_every_n: None,
max_nb_chunks: None,
documents_chunk_size: None,
max_memory: None,
max_threads: None,
chunk_compression_type: CompressionType::None,
chunk_compression_level: None,
max_positions_per_attributes: None,
skip_index_budget: false,
thread_pool,
}
}
}