mirror of
https://github.com/meilisearch/MeiliSearch
synced 2025-07-03 03:47:02 +02:00
fix a deadlock
This commit is contained in:
parent
22bfb5a7a0
commit
0ba1c46e19
2 changed files with 52 additions and 13 deletions
|
@ -427,7 +427,7 @@ impl IndexScheduler {
|
|||
Ok(None)
|
||||
}
|
||||
|
||||
pub(crate) fn process_batch(&self, wtxn: &mut RwTxn, batch: Batch) -> Result<Vec<Task>> {
|
||||
pub(crate) fn process_batch(&self, batch: Batch) -> Result<Vec<Task>> {
|
||||
match batch {
|
||||
Batch::Cancel(_) => todo!(),
|
||||
Batch::Snapshot(_) => todo!(),
|
||||
|
@ -439,7 +439,12 @@ impl IndexScheduler {
|
|||
content_files,
|
||||
mut tasks,
|
||||
} => {
|
||||
let index = self.index_mapper.create_index(wtxn, &index_uid)?;
|
||||
// we NEED a write transaction for the index creation.
|
||||
// To avoid blocking the whole process we're going to commit asap.
|
||||
let mut wtxn = self.env.write_txn()?;
|
||||
let index = self.index_mapper.create_index(&mut wtxn, &index_uid)?;
|
||||
wtxn.commit()?;
|
||||
|
||||
let ret = index.update_documents(
|
||||
IndexDocumentsMethod::ReplaceDocuments,
|
||||
primary_key,
|
||||
|
@ -474,7 +479,9 @@ impl IndexScheduler {
|
|||
settings: _,
|
||||
settings_tasks: _,
|
||||
} => {
|
||||
let index = self.index_mapper.create_index(wtxn, &index_uid)?;
|
||||
let mut wtxn = self.env.write_txn()?;
|
||||
let index = self.index_mapper.create_index(&mut wtxn, &index_uid)?;
|
||||
wtxn.commit()?;
|
||||
let mut updated_tasks = Vec::new();
|
||||
|
||||
/*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue