From dc8a2d31946a81e7a69b3b7ab838f381c830dfc2 Mon Sep 17 00:00:00 2001 From: Neil Johnson Date: Fri, 11 Oct 2019 15:47:10 +0100 Subject: [PATCH] respond to review comments --- docs/sample_config.yaml | 7 ++++--- synapse/config/server.py | 9 +++++---- synapse/server_notices/resource_limits_server_notices.py | 4 ++-- .../test_resource_limits_server_notices.py | 4 ++-- 4 files changed, 13 insertions(+), 11 deletions(-) diff --git a/docs/sample_config.yaml b/docs/sample_config.yaml index 0157a4ebc7..6847d8f136 100644 --- a/docs/sample_config.yaml +++ b/docs/sample_config.yaml @@ -261,15 +261,16 @@ listeners: # sign up in a short space of time never to return after their initial # session. # -# 'mau_suppress_alerting' is a means of limiting client side alerting +# 'mau_limit_alerting' is a means of limiting client side alerting # should the mau limit be reached. This is useful for small instances # where the admin has 5 mau seats (say) for 5 specific people and no -# interest increasing the mau limit further. Defaults to False. +# interest increasing the mau limit further. Defaults to True, which +# means that alerting is enabled # #limit_usage_by_mau: False #max_mau_value: 50 #mau_trial_days: 2 -#mau_suppress_alerting: True +#mau_limit_alerting: False # If enabled, the metrics for the number of monthly active users will # be populated, however no one will be limited. If limit_usage_by_mau diff --git a/synapse/config/server.py b/synapse/config/server.py index 89bc4fa28d..0a795bfb06 100644 --- a/synapse/config/server.py +++ b/synapse/config/server.py @@ -171,7 +171,7 @@ class ServerConfig(Config): ) self.mau_trial_days = config.get("mau_trial_days", 0) - self.mau_suppress_alerting = config.get("mau_suppress_alerting", False) + self.mau_limit_alerting = config.get("mau_limit_alerting", True) # How long to keep redacted events in the database in unredacted form # before redacting them. @@ -696,15 +696,16 @@ class ServerConfig(Config): # sign up in a short space of time never to return after their initial # session. # - # 'mau_suppress_alerting' is a means of limiting client side alerting + # 'mau_limit_alerting' is a means of limiting client side alerting # should the mau limit be reached. This is useful for small instances # where the admin has 5 mau seats (say) for 5 specific people and no - # interest increasing the mau limit further. Defaults to False. + # interest increasing the mau limit further. Defaults to True, which + # means that alerting is enabled # #limit_usage_by_mau: False #max_mau_value: 50 #mau_trial_days: 2 - #mau_suppress_alerting: True + #mau_limit_alerting: False # If enabled, the metrics for the number of monthly active users will # be populated, however no one will be limited. If limit_usage_by_mau diff --git a/synapse/server_notices/resource_limits_server_notices.py b/synapse/server_notices/resource_limits_server_notices.py index 8229a4de43..a16cd4c8a5 100644 --- a/synapse/server_notices/resource_limits_server_notices.py +++ b/synapse/server_notices/resource_limits_server_notices.py @@ -70,7 +70,7 @@ class ResourceLimitsServerNotices(object): return if not self._server_notices_manager.is_enabled(): - # Don't try and send server notices unles they've been enabled + # Don't try and send server notices unless they've been enabled return timestamp = yield self._store.user_last_seen_monthly_active(user_id) @@ -91,7 +91,7 @@ class ResourceLimitsServerNotices(object): currently_blocked, ref_events = yield self._is_room_currently_blocked(room_id) try: - if self._config.mau_suppress_alerting: + if not self._config.mau_limit_alerting: # Alerting disabled, reset room if necessary and return if currently_blocked: content = {"pinned": ref_events} diff --git a/tests/server_notices/test_resource_limits_server_notices.py b/tests/server_notices/test_resource_limits_server_notices.py index 490051afe8..705fb0d376 100644 --- a/tests/server_notices/test_resource_limits_server_notices.py +++ b/tests/server_notices/test_resource_limits_server_notices.py @@ -163,7 +163,7 @@ class TestResourceLimitsServerNotices(unittest.HomeserverTestCase): Test that when server is over MAU limit and alerting is suppressed, then an alert message is not sent into the room """ - self.hs.config.mau_suppress_alerting = True + self.hs.config.mau_limit_alerting = False self._rlsn._auth.check_auth_blocking = Mock( side_effect=ResourceLimitError(403, "foo") ) @@ -176,7 +176,7 @@ class TestResourceLimitsServerNotices(unittest.HomeserverTestCase): When the room is already in a blocked state, test that when alerting is suppressed that the room is returned to an unblocked state. """ - self.hs.config.mau_suppress_alerting = True + self.hs.config.mau_limit_alerting = False self._rlsn._auth.check_auth_blocking = Mock( side_effect=ResourceLimitError(403, "foo") )