summary refs log tree commit diff
path: root/synapse/replication/slave/storage/presence.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2017-03-27 16:32:07 +0100
committerErik Johnston <erik@matrix.org>2017-04-03 15:34:19 +0100
commit3a1f3f838862cfd2486773079d01e30c2237e8c2 (patch)
tree6376669911c085a691a2c9862291b67d0a86dfc6 /synapse/replication/slave/storage/presence.py
parentAdd basic replication client handler and factory (diff)
downloadsynapse-3a1f3f838862cfd2486773079d01e30c2237e8c2.tar.xz
Change slave storage to use new replication interface
As the TCP replication uses a slightly different API and streams than
the HTTP replication.

This breaks HTTP replication.
Diffstat (limited to 'synapse/replication/slave/storage/presence.py')
-rw-r--r--synapse/replication/slave/storage/presence.py19
1 files changed, 9 insertions, 10 deletions
diff --git a/synapse/replication/slave/storage/presence.py b/synapse/replication/slave/storage/presence.py
index e4a2414d78..dffc80adc3 100644
--- a/synapse/replication/slave/storage/presence.py
+++ b/synapse/replication/slave/storage/presence.py
@@ -48,15 +48,14 @@ class SlavedPresenceStore(BaseSlavedStore):
         result["presence"] = position
         return result
 
-    def process_replication(self, result):
-        stream = result.get("presence")
-        if stream:
-            self._presence_id_gen.advance(int(stream["position"]))
-            for row in stream["rows"]:
-                position, user_id = row[:2]
+    def process_replication_rows(self, stream_name, token, rows):
+        if stream_name == "presence":
+            self._presence_id_gen.advance(token)
+            for row in rows:
                 self.presence_stream_cache.entity_has_changed(
-                    user_id, position
+                    row.user_id, token
                 )
-                self._get_presence_for_user.invalidate((user_id,))
-
-        return super(SlavedPresenceStore, self).process_replication(result)
+                self._get_presence_for_user.invalidate((row.user_id,))
+        return super(SlavedPresenceStore, self).process_replication_rows(
+            stream_name, token, rows
+        )