mirror of
https://mau.dev/maunium/synapse.git
synced 2024-09-04 08:32:29 +00:00
Merge branch 'neilj/mau_tracker' of github.com:matrix-org/synapse into neilj/mau_tracker
This commit is contained in:
commit
4a6725d9d1
@ -94,7 +94,6 @@ class DataStore(RoomMemberStore, RoomStore,
|
|||||||
self._clock = hs.get_clock()
|
self._clock = hs.get_clock()
|
||||||
self.database_engine = hs.database_engine
|
self.database_engine = hs.database_engine
|
||||||
|
|
||||||
self.db_conn = db_conn
|
|
||||||
self._stream_id_gen = StreamIdGenerator(
|
self._stream_id_gen = StreamIdGenerator(
|
||||||
db_conn, "events", "stream_ordering",
|
db_conn, "events", "stream_ordering",
|
||||||
extra_tables=[("local_invites", "stream_id")]
|
extra_tables=[("local_invites", "stream_id")]
|
||||||
|
@ -7,6 +7,7 @@ class MonthlyActiveUsersStore(SQLBaseStore):
|
|||||||
def __init__(self, hs):
|
def __init__(self, hs):
|
||||||
super(MonthlyActiveUsersStore, self).__init__(None, hs)
|
super(MonthlyActiveUsersStore, self).__init__(None, hs)
|
||||||
self._clock = hs.get_clock()
|
self._clock = hs.get_clock()
|
||||||
|
self.max_mau_value = hs.config.max_mau_value
|
||||||
|
|
||||||
def reap_monthly_active_users(self):
|
def reap_monthly_active_users(self):
|
||||||
"""
|
"""
|
||||||
@ -19,7 +20,9 @@ class MonthlyActiveUsersStore(SQLBaseStore):
|
|||||||
thirty_days_ago = (
|
thirty_days_ago = (
|
||||||
int(self._clock.time_msec()) - (1000 * 60 * 60 * 24 * 30)
|
int(self._clock.time_msec()) - (1000 * 60 * 60 * 24 * 30)
|
||||||
)
|
)
|
||||||
|
|
||||||
sql = "DELETE FROM monthly_active_users WHERE timestamp < ?"
|
sql = "DELETE FROM monthly_active_users WHERE timestamp < ?"
|
||||||
|
|
||||||
txn.execute(sql, (thirty_days_ago,))
|
txn.execute(sql, (thirty_days_ago,))
|
||||||
|
|
||||||
return self.runInteraction("reap_monthly_active_users", _reap_users)
|
return self.runInteraction("reap_monthly_active_users", _reap_users)
|
||||||
|
Loading…
Reference in New Issue
Block a user