0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2025-01-15 17:16:49 +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" is_own_membership && data.membership == "join"
}; };
if(is_own_join)
return false;
const ssize_t &viewport_size const ssize_t &viewport_size
{ {
room::events::viewport_size room::events::viewport_size
@ -153,21 +156,6 @@ ircd::m::sync::room_state_linear_events(data &data)
*data.out, state_member_name *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 json::stack::array array
{ {
*data.out, "events" *data.out, "events"

View file

@ -146,36 +146,20 @@ ircd::m::sync::room_timeline_linear(data &data)
*data.out, "timeline" *data.out, "timeline"
}; };
// Branch to backfill the user's timeline before their own join event to if(is_own_join)
// 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)
{ {
const event::idx range_first json::stack::member
{ {
!is_invite_accept && last_membership_state_idx? timeline, "limited", json::value{true}
last_membership_state_idx + 1: // start after last state
0UL
}; };
const scope_restore data_range_first json::stack::member
{ {
data.range.first, range_first timeline, "prev_batch", json::value
};
const scope_restore data_range_second
{ {
data.range.second, std::max(data.event_idx + 1, data.range.second) string_view{data.event->event_id}
}
}; };
bool ret{false}, limited{false};
const auto prev_batch
{
_room_timeline_polylog_events(data, *data.room, limited, ret)
};
return ret;
} }
json::stack::array array json::stack::array array