Skip to content

Commit

Permalink
lib/mu-xapian-db: handle exception with dec_transaction_level
Browse files Browse the repository at this point in the history
I.e., do our book-keeping beforehand.
  • Loading branch information
djcb committed Jan 23, 2024
1 parent ffac840 commit 62f0a9a
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/mu-xapian-db.hh
Original file line number Diff line number Diff line change
Expand Up @@ -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?

--tx_level_;
if (tx_level_ == 0) {// need to commit the Xapian transaction?
mu_debug("committing {} changes", changes_);
wdb().commit_transaction();
changes_ = 0;
wdb().commit_transaction();
}
--tx_level_;

mu_debug("dec'd tx level to {}", tx_level_);
});
}
Expand Down

0 comments on commit 62f0a9a

Please sign in to comment.