Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Limit number of events in a replication request (#10118)
Browse files Browse the repository at this point in the history
Fixes #9956.
  • Loading branch information
erikjohnston authored Jun 4, 2021
1 parent d8be7d4 commit c96ab31
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions changelog.d/10118.bugfix
Original file line number Diff line number Diff line change
@@ -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.
5 changes: 3 additions & 2 deletions synapse/handlers/federation.py
Original file line number Diff line number Diff line change
Expand Up @@ -3056,8 +3056,9 @@ async def persist_events_and_notify(
"""
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,
Expand Down

0 comments on commit c96ab31

Please sign in to comment.