0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-12-27 07:54:05 +01:00

modules/client/sync/rooms: Use timeline.limited=true to eliminate branches to polylog.

This commit is contained in:
Jason Volk 2020-05-10 19:23:36 -07:00
parent aae7f7e545
commit 67e72539f3
2 changed files with 11 additions and 39 deletions

View file

@ -103,6 +103,9 @@ ircd::m::sync::room_state_linear_events(data &data)
is_own_membership && data.membership == "join"
};
if(is_own_join)
return false;
const ssize_t &viewport_size
{
room::events::viewport_size
@ -153,21 +156,6 @@ ircd::m::sync::room_state_linear_events(data &data)
*data.out, state_member_name
};
if(is_own_membership && data.membership == "join")
{
const scope_restore data_range_first
{
data.range.first, 0UL
};
const scope_restore data_range_second
{
data.range.second, std::max(data.event_idx + 1, data.range.second)
};
return room_state_polylog_events(data);
}
json::stack::array array
{
*data.out, "events"

View file

@ -146,36 +146,20 @@ ircd::m::sync::room_timeline_linear(data &data)
*data.out, "timeline"
};
// Branch to backfill the user's timeline before their own join event to
// the room. This simply reuses the polylog handler as if they were
// initial-syncing the room. This branch is not taken for rejoins (i.e
// displayname and avatar changes).
if(is_own_join && !is_own_rejoin)
if(is_own_join)
{
const event::idx range_first
json::stack::member
{
!is_invite_accept && last_membership_state_idx?
last_membership_state_idx + 1: // start after last state
0UL
timeline, "limited", json::value{true}
};
const scope_restore data_range_first
json::stack::member
{
data.range.first, range_first
timeline, "prev_batch", json::value
{
string_view{data.event->event_id}
}
};
const scope_restore data_range_second
{
data.range.second, std::max(data.event_idx + 1, data.range.second)
};
bool ret{false}, limited{false};
const auto prev_batch
{
_room_timeline_polylog_events(data, *data.room, limited, ret)
};
return ret;
}
json::stack::array array