diff options
author | Erik Johnston <erikj@jki.re> | 2017-06-27 15:36:47 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-06-27 15:36:47 +0100 |
commit | 4b444723f00d08ade995e1e757c61b9fc924aaf9 (patch) | |
tree | e5d0fe900254108d653f5d6486d720e4f57d28b5 /synapse/replication/tcp/resource.py | |
parent | Merge pull request #2307 from matrix-org/erikj/user_ip_batch (diff) | |
parent | Make workers report to master for user ip updates (diff) | |
download | synapse-4b444723f00d08ade995e1e757c61b9fc924aaf9.tar.xz |
Merge pull request #2308 from matrix-org/erikj/user_ip_repl
Make workers report to master for user ip updates
Diffstat (limited to 'synapse/replication/tcp/resource.py')
-rw-r--r-- | synapse/replication/tcp/resource.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/synapse/replication/tcp/resource.py b/synapse/replication/tcp/resource.py index 69c46911ec..3ea3ca5a6f 100644 --- a/synapse/replication/tcp/resource.py +++ b/synapse/replication/tcp/resource.py @@ -35,6 +35,7 @@ user_sync_counter = metrics.register_counter("user_sync") federation_ack_counter = metrics.register_counter("federation_ack") remove_pusher_counter = metrics.register_counter("remove_pusher") invalidate_cache_counter = metrics.register_counter("invalidate_cache") +user_ip_cache_counter = metrics.register_counter("user_ip_cache") logger = logging.getLogger(__name__) @@ -238,6 +239,15 @@ class ReplicationStreamer(object): invalidate_cache_counter.inc() getattr(self.store, cache_func).invalidate(tuple(keys)) + @measure_func("repl.on_user_ip") + def on_user_ip(self, user_id, access_token, ip, user_agent, device_id, last_seen): + """The client saw a user request + """ + user_ip_cache_counter.inc() + self.store.insert_client_ip( + user_id, access_token, ip, user_agent, device_id, last_seen, + ) + def send_sync_to_all_connections(self, data): """Sends a SYNC command to all clients. |