summary refs log tree commit diff
path: root/synapse/storage/registration.py
diff options
context:
space:
mode:
authorAndrew Morgan <andrew@amorgan.xyz>2020-02-25 10:16:48 +0000
committerAndrew Morgan <andrew@amorgan.xyz>2020-02-25 10:16:48 +0000
commit91e030ae1277bb34074430a87ff32e6bc7cade4e (patch)
tree5717386346549f73b8cf877c61e44c9bcd21c58a /synapse/storage/registration.py
parentEnsure the list media admin API is always available (#5966) (diff)
parentFix and refactor room and user stats (#5971) (diff)
downloadsynapse-91e030ae1277bb34074430a87ff32e6bc7cade4e.tar.xz
Fix and refactor room and user stats (#5971)
Diffstat (limited to 'synapse/storage/registration.py')
-rw-r--r--synapse/storage/registration.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/synapse/storage/registration.py b/synapse/storage/registration.py

index 6e7db564bb..2158ec3583 100644 --- a/synapse/storage/registration.py +++ b/synapse/storage/registration.py
@@ -891,6 +891,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,)) @@ -1162,6 +1173,7 @@ class RegistrationStore( deferred str|None: A str representing a link to redirect the user to if there is one. """ + # Insert everything into a transaction in order to run atomically def validate_threepid_session_txn(txn): row = self._simple_select_one_txn(