diff options
-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 |