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

Add a configuration setting for the dummy event threshold #7422

Merged
merged 8 commits into from
May 7, 2020
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/7422.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add a configuration setting to tweak the threshold for dummy events.
8 changes: 8 additions & 0 deletions docs/sample_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,14 @@ retention:
#
#request_token_inhibit_3pid_errors: true

# Number of forward extremities in a room at which Synapse will send a dummy
# events.
# This is to prevent forward extremities from building up in the room, which
# could lead to poor performance.
# The default value is 10.
#
#dummy_event_threshold: 5


## TLS ##

Expand Down
11 changes: 11 additions & 0 deletions synapse/config/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,9 @@ class LimitRemoteRoomsConfig(object):
"cleanup_extremities_with_dummy_events", True
)

# The number of forward extremities in a room needed to send a dummy event.
self.dummy_event_threshold = config.get("dummy_event_threshold", 10)

babolivier marked this conversation as resolved.
Show resolved Hide resolved
self.enable_ephemeral_messages = config.get("enable_ephemeral_messages", False)

# Inhibits the /requestToken endpoints from returning an error that might leak
Expand Down Expand Up @@ -993,6 +996,14 @@ def generate_config_section(
# act as if no error happened and return a fake session ID ('sid') to clients.
#
#request_token_inhibit_3pid_errors: true

# Number of forward extremities in a room at which Synapse will send a dummy
# events.
# This is to prevent forward extremities from building up in the room, which
# could lead to poor performance.
babolivier marked this conversation as resolved.
Show resolved Hide resolved
# The default value is 10.
#
#dummy_event_threshold: 5
"""
% locals()
)
Expand Down
4 changes: 3 additions & 1 deletion synapse/handlers/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,8 @@ def __init__(self, hs):

self._ephemeral_events_enabled = hs.config.enable_ephemeral_messages

self._dummy_events_threshold = hs.config.dummy_event_threshold
babolivier marked this conversation as resolved.
Show resolved Hide resolved

@defer.inlineCallbacks
def create_event(
self,
Expand Down Expand Up @@ -1085,7 +1087,7 @@ async def _send_dummy_events_to_fill_extremities(self):
"""
self._expire_rooms_to_exclude_from_dummy_event_insertion()
room_ids = await self.store.get_rooms_with_many_extremities(
min_count=10,
min_count=self._dummy_events_threshold,
limit=5,
room_id_filter=self._rooms_to_exclude_from_dummy_event_insertion.keys(),
)
Expand Down