mirror of
https://github.com/meilisearch/meilisearch.git
synced 2025-07-26 16:21:07 +00:00
Save the currently updating index so that the search can access it at all times
This commit is contained in:
@ -923,6 +923,9 @@ impl IndexScheduler {
|
||||
self.index_mapper.index(&rtxn, &index_uid)?
|
||||
};
|
||||
|
||||
// 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()));
|
||||
|
||||
let mut index_wtxn = index.write_txn()?;
|
||||
let tasks = self.apply_index_operation(&mut index_wtxn, &index, op)?;
|
||||
index_wtxn.commit()?;
|
||||
@ -959,6 +962,9 @@ impl IndexScheduler {
|
||||
Batch::IndexUpdate { index_uid, primary_key, mut task } => {
|
||||
let rtxn = self.env.read_txn()?;
|
||||
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
|
||||
*self.currently_updating_index.write().unwrap() = Some((index_uid.clone(), index.clone()));
|
||||
|
||||
|
||||
if let Some(primary_key) = primary_key.clone() {
|
||||
let mut index_wtxn = index.write_txn()?;
|
||||
|
Reference in New Issue
Block a user