From 6ec575f8debb46354c49d10e9c07566be53ef4b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Renault?= Date: Wed, 9 Oct 2019 15:49:35 +0200 Subject: [PATCH] Use a buffered sync channel to avoid blocking the update system --- meilidb-core/examples/from_file.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/meilidb-core/examples/from_file.rs b/meilidb-core/examples/from_file.rs index 513a0b642..ec40e13b9 100644 --- a/meilidb-core/examples/from_file.rs +++ b/meilidb-core/examples/from_file.rs @@ -84,7 +84,7 @@ struct Document(indexmap::IndexMap); fn index_command(command: IndexCommand, database: Database) -> Result<(), Box> { let start = Instant::now(); - let (sender, receiver) = mpsc::sync_channel(0); + let (sender, receiver) = mpsc::sync_channel(100); let update_fn = move |update: UpdateResult| sender.send(update.update_id).unwrap(); let index = database.open_index(INDEX_NAME, Some(Box::new(update_fn)))?; let rkv = database.rkv.read().unwrap(); @@ -144,6 +144,7 @@ fn index_command(command: IndexCommand, database: Database) -> Result<(), Box