summary refs log tree commit diff
path: root/synapse/replication/slave
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2016-09-02 11:04:48 +0100
committerErik Johnston <erik@matrix.org>2016-09-02 11:04:48 +0100
commit657847e4c6b955911768e7d3025ac1b245208882 (patch)
treea826411c63b4691a7356ce2740e7b4438b8ead78 /synapse/replication/slave
parentLimit the length of state chains (diff)
parentMerge pull request #1061 from matrix-org/erikj/linearize_resolution (diff)
downloadsynapse-657847e4c6b955911768e7d3025ac1b245208882.tar.xz
Merge branch 'develop' of github.com:matrix-org/synapse into erikj/state_storage
Diffstat (limited to 'synapse/replication/slave')
-rw-r--r--synapse/replication/slave/storage/deviceinbox.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/synapse/replication/slave/storage/deviceinbox.py b/synapse/replication/slave/storage/deviceinbox.py
index 7583d23708..64d8eb2af1 100644
--- a/synapse/replication/slave/storage/deviceinbox.py
+++ b/synapse/replication/slave/storage/deviceinbox.py
@@ -28,3 +28,15 @@ class SlavedDeviceInboxStore(BaseSlavedStore):
     get_to_device_stream_token = DataStore.get_to_device_stream_token.__func__
     get_new_messages_for_device = DataStore.get_new_messages_for_device.__func__
     delete_messages_for_device = DataStore.delete_messages_for_device.__func__
+
+    def stream_positions(self):
+        result = super(SlavedDeviceInboxStore, self).stream_positions()
+        result["to_device"] = self._device_inbox_id_gen.get_current_token()
+        return result
+
+    def process_replication(self, result):
+        stream = result.get("to_device")
+        if stream:
+            self._device_inbox_id_gen.advance(int(stream["position"]))
+
+        return super(SlavedDeviceInboxStore, self).process_replication(result)