From c08dcac1d4ce437a6296c4061b720d2c38a4bdfe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Renault?= Date: Mon, 28 Oct 2019 17:55:24 +0100 Subject: [PATCH] Abort the update transaction before calling the update callback --- meilidb-core/src/database.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/meilidb-core/src/database.rs b/meilidb-core/src/database.rs index 9bd8348b3..45ddb56b7 100644 --- a/meilidb-core/src/database.rs +++ b/meilidb-core/src/database.rs @@ -35,10 +35,13 @@ fn update_awaiter(receiver: Receiver<()>, env: heed::Env, update_fn: Arc { - if status.result.is_ok() { - if let Err(e) = writer.commit() { - error!("update transaction failed: {}", e) + match status.result { + Ok(_) => { + if let Err(e) = writer.commit() { + error!("update transaction failed: {}", e) + } } + Err(_) => writer.abort(), } if let Some(ref callback) = *update_fn.load() {