From 97a5882d81d3c664665d050de8bd94c806d5a034 Mon Sep 17 00:00:00 2001 From: "Crom (Thibaut CHARLES)" Date: Mon, 15 Jan 2018 00:08:21 +0100 Subject: [PATCH] Limit room state events Signed-off-by: Thibaut CHARLES cromfr@gmail.com --- .../dendrite/syncapi/storage/current_room_state_table.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/github.com/matrix-org/dendrite/syncapi/storage/current_room_state_table.go b/src/github.com/matrix-org/dendrite/syncapi/storage/current_room_state_table.go index 7278573ca..c5554f8cf 100644 --- a/src/github.com/matrix-org/dendrite/syncapi/storage/current_room_state_table.go +++ b/src/github.com/matrix-org/dendrite/syncapi/storage/current_room_state_table.go @@ -72,7 +72,8 @@ const selectCurrentStateSQL = "" + " AND ( $2::text[] IS NULL OR sender = ANY($2) )" + " AND ( $3::text[] IS NULL OR NOT(sender = ANY($3)) )" + " AND ( $4::text[] IS NULL OR type LIKE ANY($4) )" + - " AND ( $5::text[] IS NULL OR NOT(type LIKE ANY($5)) )" + " AND ( $5::text[] IS NULL OR NOT(type LIKE ANY($5)) )" + + " LIMIT $6" const selectJoinedUsersSQL = "" + "SELECT room_id, state_key FROM syncapi_current_room_state WHERE type = 'm.room.member' AND membership = 'join'" @@ -188,7 +189,9 @@ func (s *currentRoomStateStatements) selectCurrentState( pq.StringArray(filter.Senders), pq.StringArray(filter.NotSenders), pq.StringArray(filterConvertWildcardToSQL(filter.Types)), - pq.StringArray(filterConvertWildcardToSQL(filter.NotTypes))) + pq.StringArray(filterConvertWildcardToSQL(filter.NotTypes)), + stateFilter.Limit, + ) if err != nil { return nil, err }