summary refs log tree commit diff
path: root/synapse/storage/monthly_active_users.py
diff options
context:
space:
mode:
Diffstat (limited to 'synapse/storage/monthly_active_users.py')
-rw-r--r--synapse/storage/monthly_active_users.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/synapse/storage/monthly_active_users.py b/synapse/storage/monthly_active_users.py
index 7b3f13aedf..03eeea792e 100644
--- a/synapse/storage/monthly_active_users.py
+++ b/synapse/storage/monthly_active_users.py
@@ -38,18 +38,22 @@ class MonthlyActiveUsersStore(SQLBaseStore):
             return count
         return self.runInteraction("count_users", _count_users)
 
-    def insert_monthly_active_user(self, user_id):
+    def upsert_monthly_active_user(self, user_id):
         """
             Updates or inserts monthly active user member
             Arguments:
                 user_id (str): user to add/update
         """
-        return self._simple_insert(
+        return self._simple_upsert(
             desc="upsert_monthly_active_user",
             table="monthly_active_users",
-            values={
+            keyvalues={
                 "user_id": user_id,
             },
+            values={
+                "timestamp": int(self._clock.time_msec()),
+            },
+            lock=False,
         )
 
     @defer.inlineCallbacks