This repository was archived by the owner on Apr 12, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +11
-7
lines changed Expand file tree Collapse file tree 2 files changed +11
-7
lines changed Original file line number Diff line number Diff line change 1+ Fixed a bug causing replication requests to fail when receiving a lot of events via federation.
Original file line number Diff line number Diff line change 9191 get_domain_from_id ,
9292)
9393from synapse .util .async_helpers import Linearizer , concurrently_execute
94+ from synapse .util .iterutils import batch_iter
9495from synapse .util .retryutils import NotRetryingDestination
9596from synapse .util .stringutils import shortstr
9697from synapse .visibility import filter_events_for_server
@@ -3053,13 +3054,15 @@ async def persist_events_and_notify(
30533054 """
30543055 instance = self .config .worker .events_shard_config .get_instance (room_id )
30553056 if instance != self ._instance_name :
3056- result = await self ._send_events (
3057- instance_name = instance ,
3058- store = self .store ,
3059- room_id = room_id ,
3060- event_and_contexts = event_and_contexts ,
3061- backfilled = backfilled ,
3062- )
3057+ # Limit the number of events sent over federation.
3058+ for batch in batch_iter (event_and_contexts , 1000 ):
3059+ result = await self ._send_events (
3060+ instance_name = instance ,
3061+ store = self .store ,
3062+ room_id = room_id ,
3063+ event_and_contexts = batch ,
3064+ backfilled = backfilled ,
3065+ )
30633066 return result ["max_stream_id" ]
30643067 else :
30653068 assert self .storage .persistence
You can’t perform that action at this time.
0 commit comments