mirror of
https://github.com/element-hq/synapse.git
synced 2024-11-29 07:28:55 +03:00
Limit the number of events that can be requested when backfilling events (#6864)
Limit the maximum number of events requested when backfilling events.
This commit is contained in:
parent
b0c8bdd49d
commit
7765bf3989
2 changed files with 5 additions and 0 deletions
1
changelog.d/6864.misc
Normal file
1
changelog.d/6864.misc
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Limit the number of events that can be requested by the backfill federation API to 100.
|
|
@ -1788,6 +1788,9 @@ class FederationHandler(BaseHandler):
|
||||||
if not in_room:
|
if not in_room:
|
||||||
raise AuthError(403, "Host not in room.")
|
raise AuthError(403, "Host not in room.")
|
||||||
|
|
||||||
|
# Synapse asks for 100 events per backfill request. Do not allow more.
|
||||||
|
limit = min(limit, 100)
|
||||||
|
|
||||||
events = yield self.store.get_backfill_events(room_id, pdu_list, limit)
|
events = yield self.store.get_backfill_events(room_id, pdu_list, limit)
|
||||||
|
|
||||||
events = yield filter_events_for_server(self.storage, origin, events)
|
events = yield filter_events_for_server(self.storage, origin, events)
|
||||||
|
@ -2168,6 +2171,7 @@ class FederationHandler(BaseHandler):
|
||||||
if not in_room:
|
if not in_room:
|
||||||
raise AuthError(403, "Host not in room.")
|
raise AuthError(403, "Host not in room.")
|
||||||
|
|
||||||
|
# Only allow up to 20 events to be retrieved per request.
|
||||||
limit = min(limit, 20)
|
limit = min(limit, 20)
|
||||||
|
|
||||||
missing_events = await self.store.get_missing_events(
|
missing_events = await self.store.get_missing_events(
|
||||||
|
|
Loading…
Reference in a new issue