Limit number of events in a replication request (#10118)

Fixes #9956.
pull/10132/head
Erik Johnston 2021-06-04 10:35:47 +01:00 committed by GitHub
parent d8be7d493d
commit c96ab31dff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

1
changelog.d/10118.bugfix Normal file
View File

@ -0,0 +1 @@
Fix a bug introduced in Synapse 1.33.0 which caused replication requests to fail when receiving a lot of very large events via federation.

View File

@ -3056,8 +3056,9 @@ class FederationHandler(BaseHandler):
"""
instance = self.config.worker.events_shard_config.get_instance(room_id)
if instance != self._instance_name:
# Limit the number of events sent over federation.
for batch in batch_iter(event_and_contexts, 1000):
# Limit the number of events sent over replication. We choose 200
# here as that is what we default to in `max_request_body_size(..)`
for batch in batch_iter(event_and_contexts, 200):
result = await self._send_events(
instance_name=instance,
store=self.store,