diff options
author | Erik Johnston <erik@matrix.org> | 2017-03-27 16:32:07 +0100 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2017-04-03 15:34:19 +0100 |
commit | 3a1f3f838862cfd2486773079d01e30c2237e8c2 (patch) | |
tree | 6376669911c085a691a2c9862291b67d0a86dfc6 /synapse/replication/slave/storage/deviceinbox.py | |
parent | Add basic replication client handler and factory (diff) | |
download | synapse-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/deviceinbox.py')
-rw-r--r-- | synapse/replication/slave/storage/deviceinbox.py | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/synapse/replication/slave/storage/deviceinbox.py b/synapse/replication/slave/storage/deviceinbox.py index f9102e0d89..6f3fb64770 100644 --- a/synapse/replication/slave/storage/deviceinbox.py +++ b/synapse/replication/slave/storage/deviceinbox.py @@ -53,21 +53,18 @@ class SlavedDeviceInboxStore(BaseSlavedStore): 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"])) - for row in stream["rows"]: - stream_id = row[0] - entity = row[1] - - if entity.startswith("@"): + def process_replication_rows(self, stream_name, token, rows): + if stream_name == "to_device": + self._device_inbox_id_gen.advance(token) + for row in rows: + if row.entity.startswith("@"): self._device_inbox_stream_cache.entity_has_changed( - entity, stream_id + row.entity, token ) else: self._device_federation_outbox_stream_cache.entity_has_changed( - entity, stream_id + row.entity, token ) - - return super(SlavedDeviceInboxStore, self).process_replication(result) + return super(SlavedDeviceInboxStore, self).process_replication_rows( + stream_name, token, rows + ) |