diff options
author | Erik Johnston <erik@matrix.org> | 2017-06-15 09:39:39 +0100 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2017-06-15 09:39:39 +0100 |
commit | 4b461a69311fc96ce13ed75ebe388fd6718286d1 (patch) | |
tree | da4a0c9c2bbebb7dd97ec740512204f4c9a1d0dc /synapse/storage/events.py | |
parent | Remove unhelpful test (diff) | |
download | synapse-4b461a69311fc96ce13ed75ebe388fd6718286d1.tar.xz |
Add some more stats
Diffstat (limited to 'synapse/storage/events.py')
-rw-r--r-- | synapse/storage/events.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/synapse/storage/events.py b/synapse/storage/events.py index 8e7ae73a7d..f29d71589d 100644 --- a/synapse/storage/events.py +++ b/synapse/storage/events.py @@ -1632,6 +1632,21 @@ class EventsStore(SQLBaseStore): defer.returnValue(ret) @defer.inlineCallbacks + def count_daily_active_rooms(self): + def _count(txn): + sql = """ + SELECT COALESCE(COUNT(DISTINCT room_id), 0) FROM events + WHERE type = 'm.room.message' + AND stream_ordering > ? + """ + txn.execute(sql, (self.stream_ordering_day_ago,)) + count, = txn.fetchone() + return count + + ret = yield self.runInteraction("count_daily_active_rooms", _count) + defer.returnValue(ret) + + @defer.inlineCallbacks def _background_reindex_fields_sender(self, progress, batch_size): target_min_stream_id = progress["target_min_stream_id_inclusive"] max_stream_id = progress["max_stream_id_exclusive"] |