summary refs log tree commit diff
path: root/synapse/replication/slave/storage/deviceinbox.py
diff options
context:
space:
mode:
authorMark Haines <mjark@negativecurvature.net>2016-08-31 11:08:18 +0100
committerGitHub <noreply@github.com>2016-08-31 11:08:18 +0100
commit761f9fccff8b1350775a6185ff7115594dbb5ac6 (patch)
treefdf134baf092989fb94a7356e5b9045d4bccf4c5 /synapse/replication/slave/storage/deviceinbox.py
parentMerge pull request #1056 from matrix-org/kegan/appservice-url-is-optional (diff)
parentReturn the current stream position from add_messages_to_device_inbox (diff)
downloadsynapse-761f9fccff8b1350775a6185ff7115594dbb5ac6.tar.xz
Merge pull request #1058 from matrix-org/markjh/direct_to_device_synchrotron
Add a replication stream for direct to device messages
Diffstat (limited to 'synapse/replication/slave/storage/deviceinbox.py')
-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)