diff options
author | Kegsay <kegan@matrix.org> | 2020-05-19 18:42:55 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-19 18:42:55 +0100 |
commit | 260e69d138fb82003b0a7e77aeb5cac6b3281777 (patch) | |
tree | c7df98dad3b7fe74c3e4fb396f19ccfec7a86c7e /syncapi | |
parent | 5faecdac828592b6cf9d2851e13af8fb6d1df30a (diff) |
Make "Outbound federation can backfill events" pass sytest (#1049)
- Use a backfill limit of 100 regardless of what was asked.
- Special case the create event for `StateIDsBeforeEvent`
- Trim to the limit in `syncapi`
Diffstat (limited to 'syncapi')
-rw-r--r-- | syncapi/routing/messages.go | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/syncapi/routing/messages.go b/syncapi/routing/messages.go index 67de6df7..811188cc 100644 --- a/syncapi/routing/messages.go +++ b/syncapi/routing/messages.go @@ -412,7 +412,14 @@ func (r *messagesReq) backfill(roomID string, fromEventIDs []string, limit int) } } - return res.Events, nil + // we may have got more than the requested limit so resize now + events := res.Events + if len(events) > limit { + // last `limit` events + events = events[len(events)-limit:] + } + + return events, nil } // setToDefault returns the default value for the "to" query parameter of a |