Fix room joins

This commit is contained in:
Nicolas Werner 2020-07-20 18:25:22 +02:00
parent 19f27236ea
commit f23d733cff
2 changed files with 12 additions and 9 deletions

View file

@ -1439,8 +1439,16 @@ Cache::getLastEventId(lmdb::txn &txn, const std::string &room_id)
std::optional<Cache::TimelineRange>
Cache::getTimelineRange(const std::string &room_id)
{
auto txn = lmdb::txn::begin(env_, nullptr, MDB_RDONLY);
auto orderDb = getOrderToMessageDb(txn, room_id);
auto txn = lmdb::txn::begin(env_, nullptr, MDB_RDONLY);
lmdb::dbi orderDb{0};
try {
orderDb = getOrderToMessageDb(txn, room_id);
} catch (lmdb::runtime_error &e) {
nhlog::db()->error("Can't open db for room '{}', probably doesn't exist yet. ({})",
room_id,
e.what());
return {};
}
lmdb::val indexVal, val;