summary refs log tree commit diff
path: root/synapse
diff options
context:
space:
mode:
authorOlivier Wilkinson (reivilibre) <olivier@librepush.net>2019-07-16 13:31:50 +0100
committerOlivier Wilkinson (reivilibre) <olivier@librepush.net>2019-07-17 09:46:01 +0100
commitdc68c2a101628917f22273a3b0d7798742e8febc (patch)
tree3db1d02101cd98f6d170d8042e1a2b6056c6fde4 /synapse
parentDon't decrease left_members if the user is joining for the first time. (diff)
downloadsynapse-dc68c2a101628917f22273a3b0d7798742e8febc.tar.xz
Update state_events and current_state_events upon receipt of a state
event #5690.

Signed-off-by: Olivier Wilkinson (reivilibre) <olivier@librepush.net>
Diffstat (limited to 'synapse')
-rw-r--r--synapse/handlers/stats.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/synapse/handlers/stats.py b/synapse/handlers/stats.py
index e7495f8940..d3b1db4951 100644
--- a/synapse/handlers/stats.py
+++ b/synapse/handlers/stats.py
@@ -148,6 +148,17 @@ class StatsHandler(StateDeltasHandler):
             # quantise time to the nearest bucket
             now = (now // 1000 // self.stats_bucket_size) * self.stats_bucket_size
 
+            yield self.store.update_stats_delta(
+                now, "room", room_id, "state_events", +1
+            )
+
+            if prev_event_id is None:
+                # this state event doesn't overwrite another,
+                # so it is a new effective/current state event
+                yield self.store.update_stats_delta(
+                    now, "room", room_id, "current_state_events", +1
+                )
+
             if typ == EventTypes.Member:
                 # we could use _get_key_change here but it's a bit inefficient
                 # given we're not testing for a specific result; might as well