mirror of
				https://github.com/meilisearch/meilisearch.git
				synced 2025-10-30 23:46:28 +00:00 
			
		
		
		
	refactor: prefer helper over explicit pool construction
Co-authored-by: Many the fish <many@meilisearch.com>
This commit is contained in:
		
				
					committed by
					
						 nnethercott
						nnethercott
					
				
			
			
				
	
			
			
			
						parent
						
							865f24cfef
						
					
				
				
					commit
					79db2e67fb
				
			| @@ -37,8 +37,9 @@ use index_scheduler::{IndexScheduler, IndexSchedulerOptions}; | ||||
| use meilisearch_auth::{open_auth_store_env, AuthController}; | ||||
| use meilisearch_types::milli::constants::VERSION_MAJOR; | ||||
| use meilisearch_types::milli::documents::{DocumentsBatchBuilder, DocumentsBatchReader}; | ||||
| use meilisearch_types::milli::update::{IndexDocumentsConfig, IndexDocumentsMethod, IndexerConfig}; | ||||
| use meilisearch_types::milli::ThreadPoolNoAbortBuilder; | ||||
| use meilisearch_types::milli::update::{ | ||||
|     default_thread_pool_and_threads, IndexDocumentsConfig, IndexDocumentsMethod, IndexerConfig, | ||||
| }; | ||||
| use meilisearch_types::settings::apply_settings_to_builder; | ||||
| use meilisearch_types::tasks::KindWithContent; | ||||
| use meilisearch_types::versioning::{ | ||||
| @@ -506,8 +507,7 @@ fn import_dump( | ||||
|     let base_config = index_scheduler.indexer_config(); | ||||
|  | ||||
|     let indexer_config = if base_config.max_threads.is_none() { | ||||
|         let thread_pool = | ||||
|             ThreadPoolNoAbortBuilder::new_for_indexing().num_threads(num_cpus::get()).build()?; | ||||
|         let (thread_pool, _) = default_thread_pool_and_threads(); | ||||
|  | ||||
|         let _config = IndexerConfig { thread_pool, ..*base_config }; | ||||
|         backup_config = _config; | ||||
|   | ||||
| @@ -30,7 +30,7 @@ impl IndexerConfig { | ||||
|  | ||||
| /// By default use only 1 thread for indexing in tests | ||||
| #[cfg(test)] | ||||
| fn default_thread_pool_and_threads() -> (ThreadPoolNoAbort, Option<usize>) { | ||||
| pub fn default_thread_pool_and_threads() -> (ThreadPoolNoAbort, Option<usize>) { | ||||
|     let pool = ThreadPoolNoAbortBuilder::new_for_indexing() | ||||
|         .num_threads(1) | ||||
|         .build() | ||||
| @@ -40,7 +40,7 @@ fn default_thread_pool_and_threads() -> (ThreadPoolNoAbort, Option<usize>) { | ||||
| } | ||||
|  | ||||
| #[cfg(not(test))] | ||||
| fn default_thread_pool_and_threads() -> (ThreadPoolNoAbort, Option<usize>) { | ||||
| pub fn default_thread_pool_and_threads() -> (ThreadPoolNoAbort, Option<usize>) { | ||||
|     let pool = ThreadPoolNoAbortBuilder::new_for_indexing() | ||||
|         .build() | ||||
|         .expect("failed to build default rayon thread pool"); | ||||
|   | ||||
| @@ -4,7 +4,7 @@ pub use self::concurrent_available_ids::ConcurrentAvailableIds; | ||||
| pub use self::facet::bulk::FacetsUpdateBulk; | ||||
| pub use self::facet::incremental::FacetsUpdateIncrementalInner; | ||||
| pub use self::index_documents::*; | ||||
| pub use self::indexer_config::IndexerConfig; | ||||
| pub use self::indexer_config::{default_thread_pool_and_threads, IndexerConfig}; | ||||
| pub use self::new::ChannelCongestion; | ||||
| pub use self::settings::{validate_embedding_settings, Setting, Settings}; | ||||
| pub use self::update_step::UpdateIndexingStep; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user