From dc68c2a101628917f22273a3b0d7798742e8febc Mon Sep 17 00:00:00 2001 From: "Olivier Wilkinson (reivilibre)" Date: Tue, 16 Jul 2019 13:31:50 +0100 Subject: [PATCH] Update state_events and current_state_events upon receipt of a state event #5690. Signed-off-by: Olivier Wilkinson (reivilibre) --- synapse/handlers/stats.py | 11 +++++++++++ 1 file changed, 11 insertions(+) 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