summary refs log tree commit diff
diff options
context:
space:
mode:
authorNeil Johnson <neil@matrix.org>2018-08-07 17:59:27 +0100
committerNeil Johnson <neil@matrix.org>2018-08-07 17:59:27 +0100
commitef3589063adddd1eee89f136e6a54250cce414a1 (patch)
treeff18f596b9bdbebbbf12612f59f93b7a13aa2e67
parentimplement reserved users for mau limits (diff)
downloadsynapse-ef3589063adddd1eee89f136e6a54250cce414a1.tar.xz
prevent total number of reserved users being too large
-rw-r--r--synapse/storage/monthly_active_users.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/synapse/storage/monthly_active_users.py b/synapse/storage/monthly_active_users.py
index 168f564ed5..54de5a8686 100644
--- a/synapse/storage/monthly_active_users.py
+++ b/synapse/storage/monthly_active_users.py
@@ -39,7 +39,9 @@ class MonthlyActiveUsersStore(SQLBaseStore):
         # TODO Why can't I do this in init?
         store = self.hs.get_datastore()
         reserved_user_list = []
-        for tp in threepids:
+
+        # Do not add more reserved users than the total allowable number
+        for tp in threepids[:self.hs.config.max_mau_value]:
             user_id = yield store.get_user_id_by_threepid(
                 tp["medium"], tp["address"]
             )