diff options
author | Neil Alexander <neilalexander@users.noreply.github.com> | 2021-01-19 18:00:42 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-19 18:00:42 +0000 |
commit | b70238f2d5579876d834ec393f178161599a2fa7 (patch) | |
tree | 7b39deefc186142a9a95142c9fe6331b4fa4a32f /syncapi/routing/messages.go | |
parent | 80aa9aa8b053655683cbdae1aeccb083166bc714 (diff) |
Basic sync filtering (#1721)
* Add some filtering (postgres only for now)
* Fix build error
* Try to use request filter
* Use default filter as a template when retrieving from the database
* Remove unused strut
* Update sytest-whitelist
* Add filtering to SelectEarlyEvents
* Fix Postgres selectEarlyEvents query
* Attempt filtering on SQLite
* Test limit, set field for limit/order in prepareWithFilters
* Remove debug logging, add comments
* Tweaks, debug logging
* Separate SQLite stream IDs
* Fix filtering in current state table
* Fix lock issues
* More tweaks
* Current state requires room ID
* Review comments
Diffstat (limited to 'syncapi/routing/messages.go')
-rw-r--r-- | syncapi/routing/messages.go | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/syncapi/routing/messages.go b/syncapi/routing/messages.go index e294c880..ba739148 100644 --- a/syncapi/routing/messages.go +++ b/syncapi/routing/messages.go @@ -235,12 +235,15 @@ func (r *messagesReq) retrieveEvents() ( clientEvents []gomatrixserverlib.ClientEvent, start, end types.TopologyToken, err error, ) { + eventFilter := gomatrixserverlib.DefaultRoomEventFilter() + eventFilter.Limit = r.limit + // Retrieve the events from the local database. var streamEvents []types.StreamEvent if r.fromStream != nil { toStream := r.to.StreamToken() streamEvents, err = r.db.GetEventsInStreamingRange( - r.ctx, r.fromStream, &toStream, r.roomID, r.limit, r.backwardOrdering, + r.ctx, r.fromStream, &toStream, r.roomID, &eventFilter, r.backwardOrdering, ) } else { streamEvents, err = r.db.GetEventsInTopologicalRange( |