Merge pull request #233 from meilisearch/commit-when-update-ok

Commit an update only when it is Ok
This commit is contained in:
Clément Renault 2019-10-23 16:07:48 +02:00 committed by GitHub
commit 8d9d183ce6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -35,9 +35,11 @@ fn update_awaiter(receiver: Receiver<()>, env: heed::Env, update_fn: Arc<ArcSwap
match update::update_task(&mut writer, index.clone()) { match update::update_task(&mut writer, index.clone()) {
Ok(Some(status)) => { Ok(Some(status)) => {
if status.result.is_ok() {
if let Err(e) = writer.commit() { if let Err(e) = writer.commit() {
error!("update transaction failed: {}", e) error!("update transaction failed: {}", e)
} }
}
if let Some(ref callback) = *update_fn.load() { if let Some(ref callback) = *update_fn.load() {
(callback)(status); (callback)(status);