mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-22 18:17:39 +08:00
Only spawn request threads if necessary
This commit is contained in:
parent
c668043c4f
commit
b3952e8b3d
@ -229,12 +229,15 @@ fn send_original_documents_data(
|
|||||||
let documents_chunk_cloned = original_documents_chunk.clone();
|
let documents_chunk_cloned = original_documents_chunk.clone();
|
||||||
let lmdb_writer_sx_cloned = lmdb_writer_sx.clone();
|
let lmdb_writer_sx_cloned = lmdb_writer_sx.clone();
|
||||||
|
|
||||||
let request_threads = ThreadPoolNoAbortBuilder::new()
|
let new_embedding_configs = settings_diff.new.embedding_configs.clone();
|
||||||
.num_threads(crate::vector::REQUEST_PARALLELISM)
|
|
||||||
.thread_name(|index| format!("embedding-request-{index}"))
|
|
||||||
.build()?;
|
|
||||||
|
|
||||||
if settings_diff.reindex_vectors() || !settings_diff.settings_update_only() {
|
if (settings_diff.reindex_vectors() || !settings_diff.settings_update_only())
|
||||||
|
&& new_embedding_configs.get_default().is_some()
|
||||||
|
{
|
||||||
|
let request_threads = ThreadPoolNoAbortBuilder::new()
|
||||||
|
.num_threads(crate::vector::REQUEST_PARALLELISM)
|
||||||
|
.thread_name(|index| format!("embedding-request-{index}"))
|
||||||
|
.build()?;
|
||||||
let settings_diff = settings_diff.clone();
|
let settings_diff = settings_diff.clone();
|
||||||
rayon::spawn(move || {
|
rayon::spawn(move || {
|
||||||
for (name, (embedder, prompt)) in settings_diff.new.embedding_configs.clone() {
|
for (name, (embedder, prompt)) in settings_diff.new.embedding_configs.clone() {
|
||||||
|
Loading…
Reference in New Issue
Block a user