mirror of
https://github.com/meilisearch/MeiliSearch
synced 2025-07-04 12:27:13 +02:00
Prefer using a global update callback common to all indexes
This commit is contained in:
parent
3a1f41ebdb
commit
23a89732a5
6 changed files with 77 additions and 74 deletions
|
@ -104,14 +104,14 @@ fn index_command(command: IndexCommand, database: Database) -> Result<(), Box<dy
|
|||
let start = Instant::now();
|
||||
|
||||
let (sender, receiver) = mpsc::sync_channel(100);
|
||||
let update_fn = move |update: ProcessedUpdateResult| sender.send(update.update_id).unwrap();
|
||||
let update_fn =
|
||||
move |_name: &str, update: ProcessedUpdateResult| sender.send(update.update_id).unwrap();
|
||||
let index = match database.open_index(&command.index_name) {
|
||||
Some(index) => index,
|
||||
None => database.create_index(&command.index_name).unwrap(),
|
||||
};
|
||||
|
||||
let done = database.set_update_callback(&command.index_name, Box::new(update_fn));
|
||||
assert!(done, "could not set the index update function");
|
||||
database.set_update_callback(Box::new(update_fn));
|
||||
|
||||
let env = &database.env;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue