mirror of
https://github.com/matrix-construct/construct
synced 2024-12-04 04:33:19 +01:00
modules/client/sync/rooms/state: Elide an event index query.
This commit is contained in:
parent
ac4e742010
commit
432e317314
1 changed files with 16 additions and 3 deletions
|
@ -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);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue