summary refs log tree commit diff
diff options
context:
space:
mode:
authorOlivier Wilkinson (reivilibre) <olivier@librepush.net>2019-08-08 11:44:15 +0100
committerOlivier Wilkinson (reivilibre) <olivier@librepush.net>2019-08-08 11:44:15 +0100
commit7f2ec2e9549886237375d5ae7fe1df2b4e626713 (patch)
tree7d4c0c66afda17202d4a244b425dc49bcaa543d3
parentUpdate incremental processor to use new interfaces and track total_events (diff)
downloadsynapse-7f2ec2e9549886237375d5ae7fe1df2b4e626713.tar.xz
Handle user registration and ensure they start accruing statistics
Signed-off-by: Olivier Wilkinson (reivilibre) <olivier@librepush.net>
-rw-r--r--synapse/storage/registration.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/synapse/storage/registration.py b/synapse/storage/registration.py
index 8b2c2a97ab..596b272f7b 100644
--- a/synapse/storage/registration.py
+++ b/synapse/storage/registration.py
@@ -824,6 +824,17 @@ class RegistrationStore(
                 (user_id_obj.localpart, create_profile_with_displayname),
             )
 
+        if self.hs.config.stats_enabled:
+            # we create a new completed user statistics row
+
+            # we don't strictly need current_token since this user really can't
+            # have any state deltas before now (as it is a new user), but still,
+            # we include it for completeness.
+            current_token = self._get_max_stream_id_in_current_state_deltas_txn(txn)
+            self._update_stats_delta_txn(
+                txn, now, "user", user_id, {}, complete_with_stream_id=current_token
+            )
+
         self._invalidate_cache_and_stream(txn, self.get_user_by_id, (user_id,))
         txn.call_after(self.is_guest.invalidate, (user_id,))