mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-11-26 23:04:26 +01:00
bug(http): fix task duration
This commit is contained in:
parent
38176181ac
commit
0515c6e844
@ -245,13 +245,13 @@ impl From<Task> for TaskView {
|
|||||||
_ => unreachable!("A task must always have a creation event."),
|
_ => 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 {
|
let started_at = events.iter().find_map(|e| match e {
|
||||||
TaskEvent::Processing(ts) => Some(*ts),
|
TaskEvent::Processing(ts) => Some(*ts),
|
||||||
_ => None,
|
_ => None,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
let duration = finished_at.zip(started_at).map(|(tf, ts)| (tf - ts));
|
||||||
|
|
||||||
Self {
|
Self {
|
||||||
uid: id,
|
uid: id,
|
||||||
index_uid: index_uid.into_inner(),
|
index_uid: index_uid.into_inner(),
|
||||||
|
Loading…
Reference in New Issue
Block a user