diff --git a/crates/milli/src/update/new/indexer/document_changes.rs b/crates/milli/src/update/new/indexer/document_changes.rs index f2edfb1f3..799763658 100644 --- a/crates/milli/src/update/new/indexer/document_changes.rs +++ b/crates/milli/src/update/new/indexer/document_changes.rs @@ -230,7 +230,7 @@ where send_progress.update_progress(progress_step); let pi = document_changes.iter(CHUNK_SIZE); - pi.enumerate().try_arc_for_each_try_init( + pi.try_arc_for_each_try_init( || { DocumentChangeContext::new( index, @@ -243,13 +243,10 @@ where move |index_alloc| extractor.init_data(index_alloc), ) }, - |context, (finished_documents, items)| { + |context, items| { if (must_stop_processing)() { return Err(Arc::new(InternalError::AbortedIndexation.into())); } - let finished_documents = (finished_documents * CHUNK_SIZE) as u32; - - step.store(finished_documents, Ordering::Relaxed); // Clean up and reuse the document-specific allocator context.doc_alloc.reset(); @@ -260,6 +257,7 @@ where }); let res = extractor.process(changes, context).map_err(Arc::new); + step.fetch_add(items.as_ref().len() as u32, Ordering::Relaxed); // send back the doc_alloc in the pool context.doc_allocs.get_or_default().0.set(std::mem::take(&mut context.doc_alloc)); diff --git a/crates/milli/src/update/new/indexer/document_operation.rs b/crates/milli/src/update/new/indexer/document_operation.rs index 0ce53d5d2..4418944db 100644 --- a/crates/milli/src/update/new/indexer/document_operation.rs +++ b/crates/milli/src/update/new/indexer/document_operation.rs @@ -15,7 +15,7 @@ use super::super::document_change::DocumentChange; use super::document_changes::{DocumentChangeContext, DocumentChanges}; use super::retrieve_or_guess_primary_key; use crate::documents::PrimaryKey; -use crate::progress::{AtomicSubStep, Progress}; +use crate::progress::{AtomicDocumentStep, Progress}; use crate::update::new::document::Versions; use crate::update::new::steps::IndexingStep; use crate::update::new::thread_local::MostlySend; @@ -71,8 +71,7 @@ impl<'pl> DocumentOperation<'pl> { let mut primary_key = None; let payload_count = operations.len(); - let (step, progress_step) = - AtomicSubStep::::new(payload_count as u32); + let (step, progress_step) = AtomicDocumentStep::new(payload_count as u32); progress.update_progress(progress_step); for (payload_index, operation) in operations.into_iter().enumerate() {