summary refs log tree commit diff
path: root/synapse/replication/tcp
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/replication/tcp
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 '')
-rw-r--r--synapse/replication/tcp/commands.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/synapse/replication/tcp/commands.py b/synapse/replication/tcp/commands.py
index a009214e43..171227cce2 100644
--- a/synapse/replication/tcp/commands.py
+++ b/synapse/replication/tcp/commands.py
@@ -323,14 +323,18 @@ class UserIpCommand(Command):
 
     @classmethod
     def from_line(cls, line):
-        user_id, access_token, ip, device_id, last_seen, user_agent = line.split(" ", 5)
+        user_id, jsn = line.split(" ", 1)
 
-        return cls(user_id, access_token, ip, user_agent, device_id, int(last_seen))
+        access_token, ip, user_agent, device_id, last_seen = json.loads(jsn)
+
+        return cls(
+            user_id, access_token, ip, user_agent, device_id, last_seen
+        )
 
     def to_line(self):
-        return " ".join((
-            self.user_id, self.access_token, self.ip, self.device_id,
-            str(self.last_seen), self.user_agent,
+        return self.user_id + " " + json.dumps((
+            self.access_token, self.ip, self.user_agent, self.device_id,
+            self.last_seen,
         ))