diff options
author | Erik Johnston <erik@matrix.org> | 2020-01-30 17:06:38 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-01-30 17:06:38 +0000 |
commit | b660327056cdced860d532ab2404a26946da7ef5 (patch) | |
tree | c13d3e1668c930cd2154c217bb88d44ffb820209 /synapse/handlers/devicemessage.py | |
parent | Fix sending server up commands from workers (#6811) (diff) | |
download | synapse-b660327056cdced860d532ab2404a26946da7ef5.tar.xz |
Resync remote device list when detected as stale. (#6786)
Diffstat (limited to 'synapse/handlers/devicemessage.py')
-rw-r--r-- | synapse/handlers/devicemessage.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/synapse/handlers/devicemessage.py b/synapse/handlers/devicemessage.py index 5c5fe77be2..05c4b3eec0 100644 --- a/synapse/handlers/devicemessage.py +++ b/synapse/handlers/devicemessage.py @@ -21,6 +21,7 @@ from canonicaljson import json from twisted.internet import defer from synapse.api.errors import SynapseError +from synapse.logging.context import run_in_background from synapse.logging.opentracing import ( get_active_span_text_map, log_kv, @@ -48,6 +49,8 @@ class DeviceMessageHandler(object): "m.direct_to_device", self.on_direct_to_device_edu ) + self._device_list_updater = hs.get_device_handler().device_list_updater + @defer.inlineCallbacks def on_direct_to_device_edu(self, origin, content): local_messages = {} @@ -134,8 +137,11 @@ class DeviceMessageHandler(object): unknown_devices, ) yield self.store.mark_remote_user_device_cache_as_stale(sender_user_id) - # TODO: Poke something to start trying to refetch user's - # keys. + + # Immediately attempt a resync in the background + run_in_background( + self._device_list_updater.user_device_resync, sender_user_id + ) @defer.inlineCallbacks def send_device_message(self, sender_user_id, message_type, messages): |