From 0774b1efa518850e34d86601b70b8ffef6f1676e Mon Sep 17 00:00:00 2001 From: many Date: Thu, 7 Oct 2021 15:15:34 +0200 Subject: [PATCH] Close index's heed environment when index is deleted --- .../src/index_controller/index_resolver/mod.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/meilisearch-lib/src/index_controller/index_resolver/mod.rs b/meilisearch-lib/src/index_controller/index_resolver/mod.rs index 6400f0f19..c468564a5 100644 --- a/meilisearch-lib/src/index_controller/index_resolver/mod.rs +++ b/meilisearch-lib/src/index_controller/index_resolver/mod.rs @@ -100,7 +100,9 @@ where let index = self.index_store.create(uuid, primary_key).await?; match self.index_uuid_store.insert(uid, uuid).await { Err(e) => { - let _ = self.index_store.delete(uuid).await; + if let Some(index) = self.index_store.delete(uuid).await? { + index.inner().clone().prepare_for_closing(); + } Err(e) } Ok(()) => Ok(index), @@ -126,7 +128,9 @@ where pub async fn delete_index(&self, uid: String) -> Result { match self.index_uuid_store.delete(uid.clone()).await? { Some(uuid) => { - let _ = self.index_store.delete(uuid).await; + if let Some(index) = self.index_store.delete(uuid).await? { + index.inner().clone().prepare_for_closing(); + } Ok(uuid) } None => Err(IndexResolverError::UnexistingIndex(uid)),