From ff9c92c40964e550a19576cfe2df40a19ea96e28 Mon Sep 17 00:00:00 2001 From: Louis Dureuil Date: Wed, 20 Nov 2024 15:11:26 +0100 Subject: [PATCH] rename documents -> substep --- crates/index-scheduler/src/batch.rs | 8 +++---- crates/meilisearch-types/src/tasks.rs | 22 +++++++++---------- .../update/new/indexer/document_changes.rs | 16 +++++--------- .../update/new/indexer/document_operation.rs | 4 ++-- 4 files changed, 23 insertions(+), 27 deletions(-) diff --git a/crates/index-scheduler/src/batch.rs b/crates/index-scheduler/src/batch.rs index 75b092b28..e6e05dfdd 100644 --- a/crates/index-scheduler/src/batch.rs +++ b/crates/index-scheduler/src/batch.rs @@ -1246,16 +1246,16 @@ impl IndexScheduler { current_step, finished_steps, total_steps, - finished_documents, - total_documents, + finished_substeps, + total_substeps, } = processing_tasks.write().unwrap().update_progress(progress); tracing::info!( current_step, finished_steps, total_steps, - finished_documents, - total_documents + finished_substeps, + total_substeps ); }; diff --git a/crates/meilisearch-types/src/tasks.rs b/crates/meilisearch-types/src/tasks.rs index 7f4431da1..8c2ddcc39 100644 --- a/crates/meilisearch-types/src/tasks.rs +++ b/crates/meilisearch-types/src/tasks.rs @@ -45,8 +45,8 @@ pub struct TaskProgress { pub current_step: &'static str, pub finished_steps: u16, pub total_steps: u16, - pub finished_documents: Option, - pub total_documents: Option, + pub finished_substeps: Option, + pub total_substeps: Option, } impl Default for TaskProgress { @@ -61,8 +61,8 @@ impl TaskProgress { current_step: "start", finished_steps: 0, total_steps: 1, - finished_documents: None, - total_documents: None, + finished_substeps: None, + total_substeps: None, } } @@ -78,18 +78,18 @@ impl TaskProgress { self.total_steps = progress.total_steps; if self.finished_steps < progress.finished_steps { - self.finished_documents = None; - self.total_documents = None; + self.finished_substeps = None; + self.total_substeps = None; } self.finished_steps = progress.finished_steps; - if let Some((finished_documents, total_documents)) = progress.finished_total_documents { - if let Some(task_finished_documents) = self.finished_documents { - if task_finished_documents > finished_documents { + if let Some((finished_substeps, total_substeps)) = progress.finished_total_substep { + if let Some(task_finished_substeps) = self.finished_substeps { + if task_finished_substeps > finished_substeps { return *self; } } - self.finished_documents = Some(finished_documents); - self.total_documents = Some(total_documents); + self.finished_substeps = Some(finished_substeps); + self.total_substeps = Some(total_substeps); } *self } diff --git a/crates/milli/src/update/new/indexer/document_changes.rs b/crates/milli/src/update/new/indexer/document_changes.rs index 4efebc586..45db58bbd 100644 --- a/crates/milli/src/update/new/indexer/document_changes.rs +++ b/crates/milli/src/update/new/indexer/document_changes.rs @@ -253,11 +253,7 @@ where } let finished_documents = (finished_documents * CHUNK_SIZE) as u32; - (send_progress)(Progress::from_step_documents( - step, - finished_documents, - total_documents, - )); + (send_progress)(Progress::from_step_substep(step, finished_documents, total_documents)); // Clean up and reuse the document-specific allocator context.doc_alloc.reset(); @@ -276,7 +272,7 @@ where }, )?; - (send_progress)(Progress::from_step_documents(step, total_documents, total_documents)); + (send_progress)(Progress::from_step_substep(step, total_documents, total_documents)); Ok(()) } @@ -285,7 +281,7 @@ pub struct Progress { pub finished_steps: u16, pub total_steps: u16, pub step_name: &'static str, - pub finished_total_documents: Option<(u32, u32)>, + pub finished_total_substep: Option<(u32, u32)>, } impl Progress { @@ -294,12 +290,12 @@ impl Progress { finished_steps: step.finished_steps(), total_steps: Step::total_steps(), step_name: step.name(), - finished_total_documents: None, + finished_total_substep: None, } } - pub fn from_step_documents(step: Step, finished_documents: u32, total_documents: u32) -> Self { + pub fn from_step_substep(step: Step, finished_substep: u32, total_substep: u32) -> Self { Self { - finished_total_documents: Some((finished_documents, total_documents)), + finished_total_substep: Some((finished_substep, total_substep)), ..Progress::from_step(step) } } diff --git a/crates/milli/src/update/new/indexer/document_operation.rs b/crates/milli/src/update/new/indexer/document_operation.rs index 76baf1580..b5e3502e0 100644 --- a/crates/milli/src/update/new/indexer/document_operation.rs +++ b/crates/milli/src/update/new/indexer/document_operation.rs @@ -71,7 +71,7 @@ impl<'pl> DocumentOperation<'pl> { if must_stop_processing() { return Err(InternalError::AbortedIndexation.into()); } - send_progress(Progress::from_step_documents( + send_progress(Progress::from_step_substep( Step::PreparingPayloads, payload_index as u32, payload_count as u32, @@ -117,7 +117,7 @@ impl<'pl> DocumentOperation<'pl> { operations_stats.push(PayloadStats { document_count, bytes, error }); } - send_progress(Progress::from_step_documents( + send_progress(Progress::from_step_substep( Step::PreparingPayloads, payload_count as u32, payload_count as u32,