All around me are empty spaces

This commit is contained in:
Nicolas Werner 2023-03-20 21:26:49 +01:00
parent 807bbd8f40
commit 7d5c0b7822
No known key found for this signature in database
GPG key ID: C8D75E610773F2D9

View file

@ -1956,14 +1956,24 @@ Cache::saveState(const mtx::responses::Sync &res)
bool room_has_space_update = false; bool room_has_space_update = false;
for (const auto &e : room.second.state.events) { for (const auto &e : room.second.state.events) {
if (auto se = std::get_if<StateEvent<state::space::Parent>>(&e)) { if (auto se = std::get_if<StateEvent<state::space::Parent>>(&e)) {
spaces_with_updates.insert(se->state_key); if (se->state_key.empty()) {
room_has_space_update = true; nhlog::db()->warn("Skipping space parent with empty state key in room {}",
room.first);
} else {
spaces_with_updates.insert(se->state_key);
room_has_space_update = true;
}
} }
} }
for (const auto &e : room.second.timeline.events) { for (const auto &e : room.second.timeline.events) {
if (auto se = std::get_if<StateEvent<state::space::Parent>>(&e)) { if (auto se = std::get_if<StateEvent<state::space::Parent>>(&e)) {
spaces_with_updates.insert(se->state_key); if (se->state_key.empty()) {
room_has_space_update = true; nhlog::db()->warn("Skipping space child with empty state key in room {}",
room.first);
} else {
spaces_with_updates.insert(se->state_key);
room_has_space_update = true;
}
} }
} }
@ -2013,8 +2023,8 @@ Cache::saveState(const mtx::responses::Sync &res)
if (auto newRoomInfoDump = nlohmann::json(updatedInfo).dump(); if (auto newRoomInfoDump = nlohmann::json(updatedInfo).dump();
newRoomInfoDump != originalRoomInfoDump) { newRoomInfoDump != originalRoomInfoDump) {
nhlog::db()->critical( // nhlog::db()->critical(
"Writing out new room info:\n{}\n{}", originalRoomInfoDump, newRoomInfoDump); // "Writing out new room info:\n{}\n{}", originalRoomInfoDump, newRoomInfoDump);
roomsDb_.put(txn, room.first, newRoomInfoDump); roomsDb_.put(txn, room.first, newRoomInfoDump);
} }