From 0515c6e8445fd0e76762376e98644098beec6c1c Mon Sep 17 00:00:00 2001 From: mpostma Date: Tue, 11 Jan 2022 18:01:25 +0100 Subject: [PATCH] bug(http): fix task duration --- meilisearch-http/src/task.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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(),