From 8fa5039136d971844f360e239ccce72f3088cb48 Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Fri, 29 Jan 2021 10:05:38 +0000 Subject: [PATCH] Tweaks --- syncapi/storage/postgres/current_room_state_table.go | 2 +- syncapi/streams/stream_pdu.go | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/syncapi/storage/postgres/current_room_state_table.go b/syncapi/storage/postgres/current_room_state_table.go index ce4509ff4..c232f265d 100644 --- a/syncapi/storage/postgres/current_room_state_table.go +++ b/syncapi/storage/postgres/current_room_state_table.go @@ -84,7 +84,7 @@ const selectCurrentStateSQL = "" + " AND ( $4::text[] IS NULL OR type LIKE ANY($4) )" + " AND ( $5::text[] IS NULL OR NOT(type LIKE ANY($5)) )" + " AND ( $6::bool IS NULL OR contains_url = $6 )" + - " AND NOT (event_id = ANY($7))" + + " AND event_id != ANY($7)" + " LIMIT $8" const selectJoinedUsersSQL = "" + diff --git a/syncapi/streams/stream_pdu.go b/syncapi/streams/stream_pdu.go index 87fab10d8..30cf44f0d 100644 --- a/syncapi/streams/stream_pdu.go +++ b/syncapi/streams/stream_pdu.go @@ -225,8 +225,10 @@ func (p *PDUStreamProvider) getJoinResponseForCompleteSync( // Get the event IDs of the stream events we fetched. There's no point in us excludingEventIDs := make([]string, 0, len(recentStreamEvents)) - for _, eventID := range recentStreamEvents { - excludingEventIDs = append(excludingEventIDs, eventID.EventID()) + for _, event := range recentStreamEvents { + if event.StateKey() != nil { + excludingEventIDs = append(excludingEventIDs, event.EventID()) + } } stateEvents, err := p.DB.CurrentState(ctx, roomID, stateFilter, excludingEventIDs)