summary refs log tree commit diff
path: root/synapse/storage/client_ips.py
diff options
context:
space:
mode:
authorErik Johnston <erikj@jki.re>2017-07-06 14:33:14 +0100
committerGitHub <noreply@github.com>2017-07-06 14:33:14 +0100
commited9a7f5436e1a8e5a301e8d4f667f3a22d4b028f (patch)
tree7b741de4707c9da52abf654b525ebe8e44362c24 /synapse/storage/client_ips.py
parentMerge branch 'master' of github.com:matrix-org/synapse into develop (diff)
parentSerialize user ip command as json (diff)
downloadsynapse-ed9a7f5436e1a8e5a301e8d4f667f3a22d4b028f.tar.xz
Merge pull request #2309 from matrix-org/erikj/user_ip_repl
Fix up user_ip replication commands
Diffstat (limited to 'synapse/storage/client_ips.py')
-rw-r--r--synapse/storage/client_ips.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/synapse/storage/client_ips.py b/synapse/storage/client_ips.py
index fc468ea185..3c95e90eca 100644
--- a/synapse/storage/client_ips.py
+++ b/synapse/storage/client_ips.py
@@ -56,9 +56,11 @@ class ClientIpStore(background_updates.BackgroundUpdateStore):
         )
         reactor.addSystemEventTrigger("before", "shutdown", self._update_client_ips_batch)
 
-    def insert_client_ip(self, user, access_token, ip, user_agent, device_id):
-        now = int(self._clock.time_msec())
-        key = (user.to_string(), access_token, ip)
+    def insert_client_ip(self, user_id, access_token, ip, user_agent, device_id,
+                         now=None):
+        if not now:
+            now = int(self._clock.time_msec())
+        key = (user_id, access_token, ip)
 
         try:
             last_seen = self.client_ip_last_seen.get(key)