0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-12-03 04:02:47 +01:00

modules/client/sync/rooms/state: Elide an event index query.

This commit is contained in:
Jason Volk 2019-08-03 19:40:52 -07:00
parent ac4e742010
commit 432e317314

View file

@ -306,9 +306,9 @@ ircd::m::sync::room_state_phased_events(data &data)
const auto append const auto append
{ {
[&data, &array, &ret, &mutex](const m::event &event) [&data, &array, &ret, &mutex]
(const m::event::idx &event_idx, const m::event &event)
{ {
const auto event_idx(m::index(event));
const std::lock_guard lock{mutex}; const std::lock_guard lock{mutex};
ret |= room_state_append(data, array, event, event_idx); ret |= room_state_append(data, array, event, event_idx);
} }
@ -319,7 +319,20 @@ ircd::m::sync::room_state_phased_events(data &data)
{ {
sync::pool, keys, [&data, &append](const auto &key) sync::pool, keys, [&data, &append](const auto &key)
{ {
data.room->get(std::nothrow, key.first, key.second, append); const auto &event_idx
{
data.room->get(std::nothrow, key.first, key.second)
};
const m::event::fetch event
{
event_idx, std::nothrow
};
if(unlikely(!event.valid))
return;
append(event_idx, event);
} }
}; };