mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-11-22 21:04:27 +01:00
Close index's heed environment when index is deleted
This commit is contained in:
parent
7fc7eb7457
commit
0774b1efa5
@ -100,7 +100,9 @@ where
|
|||||||
let index = self.index_store.create(uuid, primary_key).await?;
|
let index = self.index_store.create(uuid, primary_key).await?;
|
||||||
match self.index_uuid_store.insert(uid, uuid).await {
|
match self.index_uuid_store.insert(uid, uuid).await {
|
||||||
Err(e) => {
|
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)
|
Err(e)
|
||||||
}
|
}
|
||||||
Ok(()) => Ok(index),
|
Ok(()) => Ok(index),
|
||||||
@ -126,7 +128,9 @@ where
|
|||||||
pub async fn delete_index(&self, uid: String) -> Result<Uuid> {
|
pub async fn delete_index(&self, uid: String) -> Result<Uuid> {
|
||||||
match self.index_uuid_store.delete(uid.clone()).await? {
|
match self.index_uuid_store.delete(uid.clone()).await? {
|
||||||
Some(uuid) => {
|
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)
|
Ok(uuid)
|
||||||
}
|
}
|
||||||
None => Err(IndexResolverError::UnexistingIndex(uid)),
|
None => Err(IndexResolverError::UnexistingIndex(uid)),
|
||||||
|
Loading…
Reference in New Issue
Block a user