diff --git a/meilisearch-http/src/task.rs b/meilisearch-http/src/task.rs index 990e9d0b7..b81ecd7af 100644 --- a/meilisearch-http/src/task.rs +++ b/meilisearch-http/src/task.rs @@ -245,13 +245,13 @@ impl From for TaskView { _ => unreachable!("A task must always have a creation event."), }; - let duration = finished_at.map(|ts| (ts - enqueued_at)); - let started_at = events.iter().find_map(|e| match e { TaskEvent::Processing(ts) => Some(*ts), _ => None, }); + let duration = finished_at.zip(started_at).map(|(tf, ts)| (tf - ts)); + Self { uid: id, index_uid: index_uid.into_inner(),