diff options
author | Mark Haines <mjark@negativecurvature.net> | 2016-09-08 14:26:47 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-09-08 14:26:47 +0100 |
commit | 2117c409a01231de146eb38330e3941ea2564e4a (patch) | |
tree | 806152a98d66013b94882c85cb1cb6129be62e78 /synapse/replication/slave/storage/deviceinbox.py | |
parent | Log delta files we're applying (diff) | |
parent | Merge branch 'develop' into markjh/direct_to_device_federation (diff) | |
download | synapse-2117c409a01231de146eb38330e3941ea2564e4a.tar.xz |
Merge pull request #1074 from matrix-org/markjh/direct_to_device_federation
Send device messages over federation
Diffstat (limited to 'synapse/replication/slave/storage/deviceinbox.py')
-rw-r--r-- | synapse/replication/slave/storage/deviceinbox.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/synapse/replication/slave/storage/deviceinbox.py b/synapse/replication/slave/storage/deviceinbox.py index 64d8eb2af1..251078ba57 100644 --- a/synapse/replication/slave/storage/deviceinbox.py +++ b/synapse/replication/slave/storage/deviceinbox.py @@ -16,6 +16,7 @@ from ._base import BaseSlavedStore from ._slaved_id_tracker import SlavedIdTracker from synapse.storage import DataStore +from synapse.util.caches.stream_change_cache import StreamChangeCache class SlavedDeviceInboxStore(BaseSlavedStore): @@ -24,6 +25,10 @@ class SlavedDeviceInboxStore(BaseSlavedStore): self._device_inbox_id_gen = SlavedIdTracker( db_conn, "device_inbox", "stream_id", ) + self._device_inbox_stream_cache = StreamChangeCache( + "DeviceInboxStreamChangeCache", + self._device_inbox_id_gen.get_current_token() + ) get_to_device_stream_token = DataStore.get_to_device_stream_token.__func__ get_new_messages_for_device = DataStore.get_new_messages_for_device.__func__ @@ -38,5 +43,11 @@ class SlavedDeviceInboxStore(BaseSlavedStore): 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] + user_id = row[1] + self._device_inbox_stream_cache.entity_has_changed( + user_id, stream_id + ) return super(SlavedDeviceInboxStore, self).process_replication(result) |