aboutsummaryrefslogtreecommitdiff
path: root/syncapi/routing
diff options
context:
space:
mode:
Diffstat (limited to 'syncapi/routing')
-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