mirror of
https://github.com/meilisearch/MeiliSearch
synced 2025-07-03 20:07:09 +02:00
Revert thread_pool type back to Option in config
This commit is contained in:
parent
648b2876f6
commit
3b773b3416
6 changed files with 32 additions and 34 deletions
|
@ -1936,8 +1936,7 @@ pub(crate) mod tests {
|
|||
) -> Result<(), crate::error::Error> {
|
||||
let local_pool;
|
||||
let indexer_config = &self.indexer_config;
|
||||
let pool_guard = indexer_config.thread_pool.read().unwrap();
|
||||
let pool = match &*pool_guard {
|
||||
let pool = match &indexer_config.thread_pool {
|
||||
Some(pool) => pool,
|
||||
None => {
|
||||
local_pool = ThreadPoolNoAbortBuilder::new().build().unwrap();
|
||||
|
@ -2031,8 +2030,7 @@ pub(crate) mod tests {
|
|||
) -> Result<(), crate::error::Error> {
|
||||
let local_pool;
|
||||
let indexer_config = &self.indexer_config;
|
||||
let pool_guard = indexer_config.thread_pool.read().unwrap();
|
||||
let pool = match &*pool_guard {
|
||||
let pool = match &indexer_config.thread_pool {
|
||||
Some(pool) => pool,
|
||||
None => {
|
||||
local_pool = ThreadPoolNoAbortBuilder::new().build().unwrap();
|
||||
|
@ -2111,8 +2109,7 @@ pub(crate) mod tests {
|
|||
|
||||
let local_pool;
|
||||
let indexer_config = &index.indexer_config;
|
||||
let pool_guard = indexer_config.thread_pool.read().unwrap();
|
||||
let pool = match &*pool_guard {
|
||||
let pool = match &indexer_config.thread_pool {
|
||||
Some(pool) => pool,
|
||||
None => {
|
||||
local_pool = ThreadPoolNoAbortBuilder::new().build().unwrap();
|
||||
|
|
|
@ -228,10 +228,8 @@ where
|
|||
let possible_embedding_mistakes =
|
||||
crate::vector::error::PossibleEmbeddingMistakes::new(&field_distribution);
|
||||
|
||||
let pool_guard = self.indexer_config.thread_pool.read().unwrap();
|
||||
|
||||
let backup_pool;
|
||||
let pool = match &*pool_guard {
|
||||
let pool = match self.indexer_config.thread_pool {
|
||||
Some(ref pool) => pool,
|
||||
None => {
|
||||
// We initialize a backup pool with the default
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
use std::sync::RwLock;
|
||||
|
||||
use grenad::CompressionType;
|
||||
|
||||
use super::GrenadParameters;
|
||||
|
@ -13,7 +11,7 @@ pub struct IndexerConfig {
|
|||
pub max_memory: Option<usize>,
|
||||
pub chunk_compression_type: CompressionType,
|
||||
pub chunk_compression_level: Option<u32>,
|
||||
pub thread_pool: RwLock<Option<ThreadPoolNoAbort>>,
|
||||
pub thread_pool: Option<ThreadPoolNoAbort>,
|
||||
pub max_positions_per_attributes: Option<u32>,
|
||||
pub skip_index_budget: bool,
|
||||
}
|
||||
|
@ -27,6 +25,20 @@ impl IndexerConfig {
|
|||
max_nb_chunks: self.max_nb_chunks,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn clone_no_threadpool(other: &IndexerConfig) -> Self {
|
||||
Self {
|
||||
log_every_n: other.log_every_n.clone(),
|
||||
max_nb_chunks: other.max_nb_chunks.clone(),
|
||||
documents_chunk_size: other.documents_chunk_size.clone(),
|
||||
max_memory: other.max_memory.clone(),
|
||||
chunk_compression_type: other.chunk_compression_type.clone(),
|
||||
chunk_compression_level: other.chunk_compression_level.clone(),
|
||||
max_positions_per_attributes: other.max_positions_per_attributes.clone(),
|
||||
skip_index_budget: other.skip_index_budget.clone(),
|
||||
thread_pool: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for IndexerConfig {
|
||||
|
@ -38,7 +50,7 @@ impl Default for IndexerConfig {
|
|||
max_memory: None,
|
||||
chunk_compression_type: CompressionType::None,
|
||||
chunk_compression_level: None,
|
||||
thread_pool: RwLock::new(None),
|
||||
thread_pool: None,
|
||||
max_positions_per_attributes: None,
|
||||
skip_index_budget: false,
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue