Merge pull request #5884 from meilisearch/fix-the-progress-trace

Fix the quantic progress trace
This commit is contained in:
Tamo
2025-09-09 15:01:19 +00:00
committed by GitHub
2 changed files with 7 additions and 6 deletions

View File

@ -275,10 +275,10 @@ impl BatchQueue {
pub(crate) fn get_existing_batches( pub(crate) fn get_existing_batches(
&self, &self,
rtxn: &RoTxn, rtxn: &RoTxn,
tasks: impl IntoIterator<Item = BatchId>, batches: impl IntoIterator<Item = BatchId>,
processing: &ProcessingTasks, processing: &ProcessingTasks,
) -> Result<Vec<Batch>> { ) -> Result<Vec<Batch>> {
tasks batches
.into_iter() .into_iter()
.map(|batch_id| { .map(|batch_id| {
if Some(batch_id) == processing.batch.as_ref().map(|batch| batch.uid) { if Some(batch_id) == processing.batch.as_ref().map(|batch| batch.uid) {
@ -295,7 +295,7 @@ impl BatchQueue {
Ok(batch) Ok(batch)
} else { } else {
self.get_batch(rtxn, batch_id) self.get_batch(rtxn, batch_id)
.and_then(|task| task.ok_or(Error::CorruptedTaskQueue)) .and_then(|batch| batch.ok_or(Error::CorruptedTaskQueue))
} }
}) })
.collect::<Result<_>>() .collect::<Result<_>>()

View File

@ -88,11 +88,12 @@ impl Progress {
} }
pub fn accumulated_durations(&self) -> IndexMap<String, String> { pub fn accumulated_durations(&self) -> IndexMap<String, String> {
let mut inner = self.steps.write().unwrap(); let inner = self.steps.read().unwrap();
let InnerProgress { steps, durations, .. } = &mut *inner; let InnerProgress { steps, durations, .. } = &*inner;
let mut durations = durations.clone();
let now = Instant::now(); let now = Instant::now();
push_steps_durations(steps, durations, now, 0); push_steps_durations(steps, &mut durations, now, 0);
durations.drain(..).map(|(name, duration)| (name, format!("{duration:.2?}"))).collect() durations.drain(..).map(|(name, duration)| (name, format!("{duration:.2?}"))).collect()
} }