cargo fmt

This commit is contained in:
Louis Dureuil 2023-11-12 21:53:11 +01:00
parent a2d0c73b41
commit 492fc086f0
No known key found for this signature in database
2 changed files with 8 additions and 5 deletions

View File

@ -924,7 +924,8 @@ impl IndexScheduler {
}; };
// the index operation can take a long time, so save this handle to make it available tothe search for the duration of the tick // the index operation can take a long time, so save this handle to make it available tothe search for the duration of the tick
*self.currently_updating_index.write().unwrap() = Some((index_uid.clone(), index.clone())); *self.currently_updating_index.write().unwrap() =
Some((index_uid.clone(), index.clone()));
let mut index_wtxn = index.write_txn()?; let mut index_wtxn = index.write_txn()?;
let tasks = self.apply_index_operation(&mut index_wtxn, &index, op)?; let tasks = self.apply_index_operation(&mut index_wtxn, &index, op)?;
@ -963,8 +964,8 @@ impl IndexScheduler {
let rtxn = self.env.read_txn()?; let rtxn = self.env.read_txn()?;
let index = self.index_mapper.index(&rtxn, &index_uid)?; let index = self.index_mapper.index(&rtxn, &index_uid)?;
// the index update can take a long time, so save this handle to make it available tothe search for the duration of the tick // the index update can take a long time, so save this handle to make it available tothe search for the duration of the tick
*self.currently_updating_index.write().unwrap() = Some((index_uid.clone(), index.clone())); *self.currently_updating_index.write().unwrap() =
Some((index_uid.clone(), index.clone()));
if let Some(primary_key) = primary_key.clone() { if let Some(primary_key) = primary_key.clone() {
let mut index_wtxn = index.write_txn()?; let mut index_wtxn = index.write_txn()?;

View File

@ -658,9 +658,11 @@ impl IndexScheduler {
/// If you need to fetch information from or perform an action on all indexes, /// If you need to fetch information from or perform an action on all indexes,
/// see the `try_for_each_index` function. /// see the `try_for_each_index` function.
pub fn index(&self, name: &str) -> Result<Index> { pub fn index(&self, name: &str) -> Result<Index> {
if let Some((current_name, current_index)) = self.currently_updating_index.read().unwrap().as_ref() { if let Some((current_name, current_index)) =
self.currently_updating_index.read().unwrap().as_ref()
{
if current_name == name { if current_name == name {
return Ok(current_index.clone()) return Ok(current_index.clone());
} }
} }
let rtxn = self.env.read_txn()?; let rtxn = self.env.read_txn()?;