mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-22 01:57:41 +08:00
rename documents -> substep
This commit is contained in:
parent
8380ddbdcd
commit
ff9c92c409
@ -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
|
||||
);
|
||||
};
|
||||
|
||||
|
@ -45,8 +45,8 @@ pub struct TaskProgress {
|
||||
pub current_step: &'static str,
|
||||
pub finished_steps: u16,
|
||||
pub total_steps: u16,
|
||||
pub finished_documents: Option<u32>,
|
||||
pub total_documents: Option<u32>,
|
||||
pub finished_substeps: Option<u32>,
|
||||
pub total_substeps: Option<u32>,
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user