Abort the update transaction before calling the update callback

This commit is contained in:
Clément Renault 2019-10-28 17:55:24 +01:00
parent a17dccd84e
commit c08dcac1d4
No known key found for this signature in database
GPG Key ID: 92ADA4E935E71FA4

View File

@ -35,10 +35,13 @@ 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() { match status.result {
if let Err(e) = writer.commit() { Ok(_) => {
error!("update transaction failed: {}", e) if let Err(e) = writer.commit() {
error!("update transaction failed: {}", e)
}
} }
Err(_) => writer.abort(),
} }
if let Some(ref callback) = *update_fn.load() { if let Some(ref callback) = *update_fn.load() {