Fix duplicate check possibly leaving large gaps if initial state was not in timeline

This commit is contained in:
Nicolas Werner 2021-09-06 01:41:04 +02:00
parent 6d35ef2f2f
commit 80fa3e801f
No known key found for this signature in database
GPG key ID: C8D75E610773F2D9

View file

@ -3005,7 +3005,7 @@ Cache::saveTimelineMessages(lmdb::txn &txn,
// is already in the DB, we skip putting it (again) in ordered DBs, and only // is already in the DB, we skip putting it (again) in ordered DBs, and only
// update the event itself and its relations. // update the event itself and its relations.
std::string_view unused_read; std::string_view unused_read;
if (!eventsDb.get(txn, event_id, unused_read)) { if (!evToOrderDb.get(txn, event_id, unused_read)) {
++index; ++index;
nhlog::db()->debug("saving '{}'", orderEntry.dump()); nhlog::db()->debug("saving '{}'", orderEntry.dump());
@ -3090,7 +3090,7 @@ Cache::saveOldMessages(const std::string &room_id, const mtx::responses::Message
// already in the DB, we skip putting it (again) in ordered DBs, and only update the // already in the DB, we skip putting it (again) in ordered DBs, and only update the
// event itself and its relations. // event itself and its relations.
std::string_view unused_read; std::string_view unused_read;
if (!eventsDb.get(txn, event_id, unused_read)) { if (!evToOrderDb.get(txn, event_id, unused_read)) {
--index; --index;
json orderEntry = json::object(); json orderEntry = json::object();