diff options
author | Olivier Wilkinson (reivilibre) <olivier@librepush.net> | 2019-08-08 11:43:25 +0100 |
---|---|---|
committer | Olivier Wilkinson (reivilibre) <olivier@librepush.net> | 2019-08-08 11:43:25 +0100 |
commit | a59da511ce0bb2bee3a3aee4ff657271c18c859f (patch) | |
tree | 60dec8faec8283cf6b792d0bbadfa4e1e4847cc9 | |
parent | Adapt state delta handling to match the new interface (diff) | |
download | synapse-a59da511ce0bb2bee3a3aee4ff657271c18c859f.tar.xz |
Update public room visibility change handler
Signed-off-by: Olivier Wilkinson (reivilibre) <olivier@librepush.net>
-rw-r--r-- | synapse/handlers/stats.py | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/synapse/handlers/stats.py b/synapse/handlers/stats.py index bbd120a493..76bab4a80e 100644 --- a/synapse/handlers/stats.py +++ b/synapse/handlers/stats.py @@ -16,6 +16,7 @@ import logging from twisted.internet import defer +from twisted.internet.defer import ensureDeferred from synapse.api.constants import EventTypes, JoinRules, Membership from synapse.handlers.state_deltas import StateDeltasHandler @@ -352,11 +353,16 @@ class StatsHandler(StateDeltasHandler): for user_id in user_ids: if self.hs.is_mine(UserID.from_string(user_id)): - yield self.store.update_stats_delta( - ts, "user", user_id, "public_rooms", +1 if is_public else -1 - ) - yield self.store.update_stats_delta( - ts, "user", user_id, "private_rooms", -1 if is_public else +1 + yield ensureDeferred( + self.store.update_stats_delta( + ts, + "user", + user_id, + { + "public_rooms": +1 if is_public else -1, + "private_rooms": -1 if is_public else +1, + }, + ) ) @defer.inlineCallbacks |