Add hard limit at 100 events, same as Synapse

This commit is contained in:
Till Faelligen 2024-01-20 19:56:26 +01:00
parent b2f99b31b9
commit 457baac766
No known key found for this signature in database
GPG key ID: 3DF82D8AB9211D4E

View file

@ -95,6 +95,12 @@ func Backfill(
}
}
// Enforce a limit of 100 events, as not to hit the DB to hard.
// Synapse has a hard limit of 100 events as well.
if req.Limit > 100 {
req.Limit = 100
}
// Query the Roomserver.
if err = rsAPI.PerformBackfill(httpReq.Context(), &req, &res); err != nil {
util.GetLogger(httpReq.Context()).WithError(err).Error("query.PerformBackfill failed")