mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-11-26 14:54:27 +01:00
Log the error instead of returning it when deletion fails
This commit is contained in:
parent
0774b1efa5
commit
a92a0c3ed3
@ -6,6 +6,7 @@ use std::path::Path;
|
|||||||
|
|
||||||
use error::{IndexResolverError, Result};
|
use error::{IndexResolverError, Result};
|
||||||
use index_store::{IndexStore, MapIndexStore};
|
use index_store::{IndexStore, MapIndexStore};
|
||||||
|
use log::error;
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
use uuid_store::{HeedUuidStore, UuidStore};
|
use uuid_store::{HeedUuidStore, UuidStore};
|
||||||
|
|
||||||
@ -100,9 +101,13 @@ 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) => {
|
||||||
if let Some(index) = self.index_store.delete(uuid).await? {
|
match self.index_store.delete(uuid).await {
|
||||||
|
Ok(Some(index)) => {
|
||||||
index.inner().clone().prepare_for_closing();
|
index.inner().clone().prepare_for_closing();
|
||||||
}
|
}
|
||||||
|
Ok(None) => (),
|
||||||
|
Err(e) => error!("Error while deleting index: {:?}", e),
|
||||||
|
}
|
||||||
Err(e)
|
Err(e)
|
||||||
}
|
}
|
||||||
Ok(()) => Ok(index),
|
Ok(()) => Ok(index),
|
||||||
@ -128,9 +133,13 @@ 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) => {
|
||||||
if let Some(index) = self.index_store.delete(uuid).await? {
|
match self.index_store.delete(uuid).await {
|
||||||
|
Ok(Some(index)) => {
|
||||||
index.inner().clone().prepare_for_closing();
|
index.inner().clone().prepare_for_closing();
|
||||||
}
|
}
|
||||||
|
Ok(None) => (),
|
||||||
|
Err(e) => error!("Error while deleting index: {:?}", e),
|
||||||
|
}
|
||||||
Ok(uuid)
|
Ok(uuid)
|
||||||
}
|
}
|
||||||
None => Err(IndexResolverError::UnexistingIndex(uid)),
|
None => Err(IndexResolverError::UnexistingIndex(uid)),
|
||||||
|
Loading…
Reference in New Issue
Block a user