diff options
author | Olivier Wilkinson (reivilibre) <olivier@librepush.net> | 2019-08-28 15:46:33 +0100 |
---|---|---|
committer | Olivier Wilkinson (reivilibre) <olivier@librepush.net> | 2019-08-28 15:46:33 +0100 |
commit | b06f2947e4a79220564da94f2ca3feb988f033ed (patch) | |
tree | 1a0e11a750b7ce8e5e6117b6f83f5479455e41c7 | |
parent | Merge pull request #5890 from matrix-org/rei/rss_inc3 (diff) | |
download | synapse-b06f2947e4a79220564da94f2ca3feb988f033ed.tar.xz |
Track new users in user statistics.
This makes the rows 'completed' so that the stats regenerator need not touch them.
-rw-r--r-- | synapse/storage/registration.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/synapse/storage/registration.py b/synapse/storage/registration.py index 9027b917c1..672eebbe56 100644 --- a/synapse/storage/registration.py +++ b/synapse/storage/registration.py @@ -868,6 +868,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,)) @@ -1139,6 +1150,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( |