diff --git a/meilisearch-http/src/index_controller/local_index_controller/mod.rs b/meilisearch-http/src/index_controller/local_index_controller/mod.rs index 14efe42c7..d3fa532dc 100644 --- a/meilisearch-http/src/index_controller/local_index_controller/mod.rs +++ b/meilisearch-http/src/index_controller/local_index_controller/mod.rs @@ -103,11 +103,21 @@ impl IndexController for LocalIndexController { fn all_update_status(&self, index: impl AsRef) -> anyhow::Result>> { match self.indexes.index(&index)? { Some((_, update_store)) => { - let updates = update_store.iter_metas(|processing, processed, pending, aborted, failed| { + let updates = update_store.iter_metas(|processing, processed, aborted, pending, failed| { + let processing_id = processing + .as_ref() + .map(|p| p.id()); + Ok(processing .map(UpdateStatus::from) .into_iter() - .chain(pending.filter_map(|p| p.ok()).map(|(_, u)| UpdateStatus::from(u))) + .chain(pending. + filter_map(Result::ok) + // If an update is processing, filter out this update from the pending + // updates. + .filter(|(_, u)| processing_id + .map_or(true, |id| id != u.id())) + .map(|(_, u)| UpdateStatus::from(u))) .chain(aborted.filter_map(Result::ok).map(|(_, u)| UpdateStatus::from(u))) .chain(processed.filter_map(Result::ok).map(|(_, u)| UpdateStatus::from(u))) .chain(failed.filter_map(Result::ok).map(|(_, u)| UpdateStatus::from(u))) diff --git a/meilisearch-http/tests/updates/mod.rs b/meilisearch-http/tests/updates/mod.rs index 3fff2d911..03b307daf 100644 --- a/meilisearch-http/tests/updates/mod.rs +++ b/meilisearch-http/tests/updates/mod.rs @@ -50,9 +50,7 @@ async fn list_no_updates() { assert!(response.as_array().unwrap().is_empty()); } -// TODO: fix #32 #[actix_rt::test] -#[ignore] async fn list_updates() { let server = Server::new().await; let index = server.index("test");