mirror of https://github.com/djcb/mu.git
lib/mu-xapian-db: handle exception with dec_transaction_level
I.e., do our book-keeping beforehand.
This commit is contained in:
parent
ffac8409a3
commit
62f0a9a902
|
@ -447,12 +447,14 @@ public:
|
|||
mu_critical("cannot dec transaction-level)");
|
||||
throw std::runtime_error("cannot dec transactions");
|
||||
}
|
||||
if (tx_level_ == 1) {// need to commit the Xapian transaction?
|
||||
mu_debug("committing {} changes", changes_);
|
||||
wdb().commit_transaction();
|
||||
changes_ = 0;
|
||||
}
|
||||
|
||||
--tx_level_;
|
||||
if (tx_level_ == 0) {// need to commit the Xapian transaction?
|
||||
mu_debug("committing {} changes", changes_);
|
||||
changes_ = 0;
|
||||
wdb().commit_transaction();
|
||||
}
|
||||
|
||||
mu_debug("dec'd tx level to {}", tx_level_);
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue