summary refs log tree commit diff
diff options
context:
space:
mode:
authorOlivier Wilkinson (reivilibre) <olivier@librepush.net>2019-08-08 11:43:25 +0100
committerOlivier Wilkinson (reivilibre) <olivier@librepush.net>2019-08-08 11:43:25 +0100
commita59da511ce0bb2bee3a3aee4ff657271c18c859f (patch)
tree60dec8faec8283cf6b792d0bbadfa4e1e4847cc9
parentAdapt state delta handling to match the new interface (diff)
downloadsynapse-a59da511ce0bb2bee3a3aee4ff657271c18c859f.tar.xz
Update public room visibility change handler
Signed-off-by: Olivier Wilkinson (reivilibre) <olivier@librepush.net>
-rw-r--r--synapse/handlers/stats.py16
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