mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-12-23 21:20:24 +01:00
Make sure to remove newly created index if uid is already taken
This commit is contained in:
parent
5e3e108143
commit
7fc7eb7457
@ -98,8 +98,13 @@ where
|
|||||||
}
|
}
|
||||||
let uuid = Uuid::new_v4();
|
let uuid = Uuid::new_v4();
|
||||||
let index = self.index_store.create(uuid, primary_key).await?;
|
let index = self.index_store.create(uuid, primary_key).await?;
|
||||||
self.index_uuid_store.insert(uid, uuid).await?;
|
match self.index_uuid_store.insert(uid, uuid).await {
|
||||||
Ok(index)
|
Err(e) => {
|
||||||
|
let _ = self.index_store.delete(uuid).await;
|
||||||
|
Err(e)
|
||||||
|
}
|
||||||
|
Ok(()) => Ok(index),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn list(&self) -> Result<Vec<(String, Index)>> {
|
pub async fn list(&self) -> Result<Vec<(String, Index)>> {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user