diff options
author | Richard van der Hoff <1389908+richvdh@users.noreply.github.com> | 2019-03-19 10:06:40 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-19 10:06:40 +0000 |
commit | fd463b4f5db3fb164505bc2b2300c6a5f73c73e4 (patch) | |
tree | 5191eb24d335448e701abd326956c55dfc9d4fa1 /synapse/config/ratelimiting.py | |
parent | Migrate the user directory initial population to a background task (#4864) (diff) | |
download | synapse-fd463b4f5db3fb164505bc2b2300c6a5f73c73e4.tar.xz |
Comment out most options in the generated config. (#4863)
Make it so that most options in the config are optional, and commented out in the generated config. The reasons this is a good thing are as follows: * If we decide that we should change the default for an option, we can do so, and only those admins that have deliberately chosen to override that option will be stuck on the old setting. * It moves us towards a point where we can get rid of the super-surprising feature of synapse where the default settings for the config come from the generated yaml. * It makes setting up a test config for unit testing an order of magnitude easier (see forthcoming PR). * It makes the generated config more consistent, and hopefully easier for users to understand.
Diffstat (limited to 'synapse/config/ratelimiting.py')
-rw-r--r-- | synapse/config/ratelimiting.py | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/synapse/config/ratelimiting.py b/synapse/config/ratelimiting.py index 7e6cc5d0ea..898a19dd8c 100644 --- a/synapse/config/ratelimiting.py +++ b/synapse/config/ratelimiting.py @@ -24,8 +24,8 @@ class RateLimitConfig(object): class RatelimitConfig(Config): def read_config(self, config): - self.rc_messages_per_second = config["rc_messages_per_second"] - self.rc_message_burst_count = config["rc_message_burst_count"] + self.rc_messages_per_second = config.get("rc_messages_per_second", 0.2) + self.rc_message_burst_count = config.get("rc_message_burst_count", 10.0) self.rc_registration = RateLimitConfig(config.get("rc_registration", {})) @@ -36,11 +36,11 @@ class RatelimitConfig(Config): rc_login_config.get("failed_attempts", {}), ) - self.federation_rc_window_size = config["federation_rc_window_size"] - self.federation_rc_sleep_limit = config["federation_rc_sleep_limit"] - self.federation_rc_sleep_delay = config["federation_rc_sleep_delay"] - self.federation_rc_reject_limit = config["federation_rc_reject_limit"] - self.federation_rc_concurrent = config["federation_rc_concurrent"] + self.federation_rc_window_size = config.get("federation_rc_window_size", 1000) + self.federation_rc_sleep_limit = config.get("federation_rc_sleep_limit", 10) + self.federation_rc_sleep_delay = config.get("federation_rc_sleep_delay", 500) + self.federation_rc_reject_limit = config.get("federation_rc_reject_limit", 50) + self.federation_rc_concurrent = config.get("federation_rc_concurrent", 3) def default_config(self, **kwargs): return """\ @@ -48,11 +48,11 @@ class RatelimitConfig(Config): # Number of messages a client can send per second # - rc_messages_per_second: 0.2 + #rc_messages_per_second: 0.2 # Number of message a client can send before being throttled # - rc_message_burst_count: 10.0 + #rc_message_burst_count: 10.0 # Ratelimiting settings for registration and login. # @@ -90,25 +90,25 @@ class RatelimitConfig(Config): # The federation window size in milliseconds # - federation_rc_window_size: 1000 + #federation_rc_window_size: 1000 # The number of federation requests from a single server in a window # before the server will delay processing the request. # - federation_rc_sleep_limit: 10 + #federation_rc_sleep_limit: 10 # The duration in milliseconds to delay processing events from # remote servers by if they go over the sleep limit. # - federation_rc_sleep_delay: 500 + #federation_rc_sleep_delay: 500 # The maximum number of concurrent federation requests allowed # from a single server # - federation_rc_reject_limit: 50 + #federation_rc_reject_limit: 50 # The number of federation requests to concurrently process from a # single server # - federation_rc_concurrent: 3 + #federation_rc_concurrent: 3 """ |