mirror of
https://github.com/meilisearch/MeiliSearch
synced 2025-07-03 20:07:09 +02:00
Make sure to remove newly created index if uid is already taken
This commit is contained in:
parent
5e3e108143
commit
7fc7eb7457
1 changed files with 7 additions and 2 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue