mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-26 20:15:07 +08:00
fix the index creation. When an index is being created we insert it in the index_map straight away to avoid someone else from trying to re-open it. The definitive fix should be made on milli's side
This commit is contained in:
parent
9b43528bbb
commit
64e55b4db9
@ -83,7 +83,14 @@ impl IndexMapper {
|
|||||||
|
|
||||||
let index_path = self.base_path.join(uuid.to_string());
|
let index_path = self.base_path.join(uuid.to_string());
|
||||||
fs::create_dir_all(&index_path)?;
|
fs::create_dir_all(&index_path)?;
|
||||||
self.create_or_open_index(&index_path)
|
let index = self.create_or_open_index(&index_path)?;
|
||||||
|
|
||||||
|
// TODO: this is far from perfect. If the caller don't commit or fail his commit
|
||||||
|
// then we end up with an available index that should not exist and is actually
|
||||||
|
// not available in the index_mapping database.
|
||||||
|
self.index_map.write().unwrap().insert(uuid, Available(index.clone()));
|
||||||
|
|
||||||
|
Ok(index)
|
||||||
}
|
}
|
||||||
error => error,
|
error => error,
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user