From eb671958403e1f768a5f059e6720a4b8f8a69631 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Renault?= Date: Wed, 23 Oct 2019 15:52:40 +0200 Subject: [PATCH] Commit an update only when it is Ok --- meilidb-core/src/database.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/meilidb-core/src/database.rs b/meilidb-core/src/database.rs index 79f4d731e..9bd8348b3 100644 --- a/meilidb-core/src/database.rs +++ b/meilidb-core/src/database.rs @@ -35,8 +35,10 @@ fn update_awaiter(receiver: Receiver<()>, env: heed::Env, update_fn: Arc { - if let Err(e) = writer.commit() { - error!("update transaction failed: {}", e) + if status.result.is_ok() { + if let Err(e) = writer.commit() { + error!("update transaction failed: {}", e) + } } if let Some(ref callback) = *update_fn.load() {