This repository was archived by the owner on Apr 26, 2024. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ Add a configuration setting to tweak the threshold for dummy events.
Original file line number Diff line number Diff line change @@ -253,6 +253,18 @@ listeners:
253253 # bind_addresses: ['::1', '127.0.0.1']
254254 # type: manhole
255255
256+ # Forward extremities can build up in a room due to networking delays between
257+ # homeservers. Once this happens in a large room, calculation of the state of
258+ # that room can become quite expensive. To mitigate this, once the number of
259+ # forward extremities reaches a given threshold, Synapse will send an
260+ # org.matrix.dummy_event event, which will reduce the forward extremities
261+ # in the room.
262+ #
263+ # This setting defines the threshold (i.e. number of forward extremities in the
264+ # room) at which dummy events are sent. The default value is 10.
265+ #
266+ # dummy_events_threshold: 5
267+
256268
257269# # Homeserver blocking ##
258270
Original file line number Diff line number Diff line change @@ -505,6 +505,9 @@ class LimitRemoteRoomsConfig(object):
505505 "cleanup_extremities_with_dummy_events" , True
506506 )
507507
508+ # The number of forward extremities in a room needed to send a dummy event.
509+ self .dummy_events_threshold = config .get ("dummy_events_threshold" , 10 )
510+
508511 self .enable_ephemeral_messages = config .get ("enable_ephemeral_messages" , False )
509512
510513 # Inhibits the /requestToken endpoints from returning an error that might leak
@@ -823,6 +826,18 @@ def generate_config_section(
823826 # bind_addresses: ['::1', '127.0.0.1']
824827 # type: manhole
825828
829+ # Forward extremities can build up in a room due to networking delays between
830+ # homeservers. Once this happens in a large room, calculation of the state of
831+ # that room can become quite expensive. To mitigate this, once the number of
832+ # forward extremities reaches a given threshold, Synapse will send an
833+ # org.matrix.dummy_event event, which will reduce the forward extremities
834+ # in the room.
835+ #
836+ # This setting defines the threshold (i.e. number of forward extremities in the
837+ # room) at which dummy events are sent. The default value is 10.
838+ #
839+ #dummy_events_threshold: 5
840+
826841
827842 ## Homeserver blocking ##
828843
Original file line number Diff line number Diff line change @@ -419,6 +419,8 @@ def __init__(self, hs):
419419
420420 self ._ephemeral_events_enabled = hs .config .enable_ephemeral_messages
421421
422+ self ._dummy_events_threshold = hs .config .dummy_events_threshold
423+
422424 @defer .inlineCallbacks
423425 def create_event (
424426 self ,
@@ -1085,7 +1087,7 @@ async def _send_dummy_events_to_fill_extremities(self):
10851087 """
10861088 self ._expire_rooms_to_exclude_from_dummy_event_insertion ()
10871089 room_ids = await self .store .get_rooms_with_many_extremities (
1088- min_count = 10 ,
1090+ min_count = self . _dummy_events_threshold ,
10891091 limit = 5 ,
10901092 room_id_filter = self ._rooms_to_exclude_from_dummy_event_insertion .keys (),
10911093 )
You can’t perform that action at this time.
0 commit comments