aboutsummaryrefslogtreecommitdiff
path: root/syncapi
diff options
context:
space:
mode:
authorKegsay <kegan@matrix.org>2020-05-19 18:42:55 +0100
committerGitHub <noreply@github.com>2020-05-19 18:42:55 +0100
commit260e69d138fb82003b0a7e77aeb5cac6b3281777 (patch)
treec7df98dad3b7fe74c3e4fb396f19ccfec7a86c7e /syncapi
parent5faecdac828592b6cf9d2851e13af8fb6d1df30a (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.go9
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