summary refs log tree commit diff
path: root/synapse/storage/monthly_active_users.py
diff options
context:
space:
mode:
authorNeil Johnson <neil@matrix.org>2018-08-02 10:59:58 +0100
committerNeil Johnson <neil@matrix.org>2018-08-02 10:59:58 +0100
commit165e06703340667dd88eb73dfe299a4d3298b94b (patch)
treec8043934dfa079b3af4de4c942917c10df1237e0 /synapse/storage/monthly_active_users.py
parentchange monthly_active_users table to be a single column (diff)
downloadsynapse-165e06703340667dd88eb73dfe299a4d3298b94b.tar.xz
Revert "change monthly_active_users table to be a single column"
This reverts commit ec716a35b219d147dee51733b55573952799a549.
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