Merge branch 'develop' of github.com:matrix-org/synapse into neilj/fix_off_by_1+maus
5 files changed, 6 insertions, 4 deletions
diff --git a/changelog.d/3692.bugfix b/changelog.d/3692.bugfix
new file mode 100644
index 0000000000..f44e13dca1
--- /dev/null
+++ b/changelog.d/3692.bugfix
@@ -0,0 +1 @@
+Fix missing yield in synapse.storage.monthly_active_users.initialise_reserved_users
diff --git a/synapse/api/auth.py b/synapse/api/auth.py
index a9cc322d7e..108ea0ea09 100644
--- a/synapse/api/auth.py
+++ b/synapse/api/auth.py
@@ -780,7 +780,8 @@ class Auth(object):
such as monthly active user limiting or global disable flag
Args:
- user_id(str): If present, checks for presence against existing MAU cohort
+ user_id(str|None): If present, checks for presence against existing
+ MAU cohort
"""
if self.hs.config.hs_disabled:
raise AuthError(
diff --git a/synapse/storage/monthly_active_users.py b/synapse/storage/monthly_active_users.py
index 7b36accdb6..7e417f811e 100644
--- a/synapse/storage/monthly_active_users.py
+++ b/synapse/storage/monthly_active_users.py
@@ -46,7 +46,7 @@ class MonthlyActiveUsersStore(SQLBaseStore):
tp["medium"], tp["address"]
)
if user_id:
- self.upsert_monthly_active_user(user_id)
+ yield self.upsert_monthly_active_user(user_id)
reserved_user_list.append(user_id)
else:
logger.warning(
diff --git a/tests/handlers/test_sync.py b/tests/handlers/test_sync.py
index cfd37f3138..8c8b65e04e 100644
--- a/tests/handlers/test_sync.py
+++ b/tests/handlers/test_sync.py
@@ -29,7 +29,7 @@ class SyncTestCase(tests.unittest.TestCase):
@defer.inlineCallbacks
def setUp(self):
- self.hs = yield setup_test_homeserver()
+ self.hs = yield setup_test_homeserver(self.addCleanup)
self.sync_handler = SyncHandler(self.hs)
self.store = self.hs.get_datastore()
diff --git a/tests/storage/test_monthly_active_users.py b/tests/storage/test_monthly_active_users.py
index 0d58dcebc5..511acbde9b 100644
--- a/tests/storage/test_monthly_active_users.py
+++ b/tests/storage/test_monthly_active_users.py
@@ -33,7 +33,7 @@ class MonthlyActiveUsersTestCase(tests.unittest.TestCase):
@defer.inlineCallbacks
def test_initialise_reserved_users(self):
-
+ self.hs.config.max_mau_value = 5
user1 = "@user1:server"
user1_email = "user1@matrix.org"
user2 = "@user2:server"
|