logs(sliding sync): don't accumulate room ids when computing limited

This commit is contained in:
Benjamin Bouvier
2023-09-22 11:49:13 +02:00
parent d4a800aadc
commit e8624706d4

View File

@@ -945,7 +945,6 @@ impl StickyData for SlidingSyncStickyParameters {
/// TODO remove this workaround as soon as support of the `limited` flag is
/// properly implemented in the open-source proxy: https://github.com/matrix-org/sliding-sync/issues/197
// NOTE: SS proxy workaround.
#[instrument(skip_all, fields(room_id))]
fn compute_limited(
local_rooms: &BTreeMap<OwnedRoomId, SlidingSyncRoom>,
remote_rooms: &mut BTreeMap<OwnedRoomId, v4::SlidingSyncRoom>,
@@ -962,23 +961,21 @@ fn compute_limited(
continue;
}
Span::current().record("room_id", tracing::field::debug(room_id));
let remote_events = &remote_room.timeline;
if remote_events.is_empty() {
trace!("no timeline updates in the response => not limited");
trace!(%room_id, "no timeline updates in the response => not limited");
continue;
}
let Some(local_room) = local_rooms.get(room_id) else {
trace!("room isn't known locally => not limited");
trace!(%room_id, "room isn't known locally => not limited");
continue;
};
let local_events = local_room.timeline_queue();
if local_events.is_empty() {
trace!("local timeline had no events => not limited");
trace!(%room_id, "local timeline had no events => not limited");
continue;
}
@@ -1008,6 +1005,7 @@ fn compute_limited(
remote_room.limited = !overlap;
trace!(
%room_id,
num_events_response = remote_events.len(),
num_local_events,
num_local_events_with_ids = local_events_with_ids.len(),