summary refs log tree commit diff
path: root/synapse/rest/client/v2_alpha/sendtodevice.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2019-12-05 17:17:57 +0000
committerGitHub <noreply@github.com>2019-12-05 17:17:57 +0000
commitd085a8a0a56c78747aa49b982667552513d220bd (patch)
treedb031262ab8b0c314f775f23bac864645dd83c4d /synapse/rest/client/v2_alpha/sendtodevice.py
parentMerge pull request #6482 from matrix-org/erikj/port_rest_v1 (diff)
parentNewsfile (diff)
downloadsynapse-d085a8a0a56c78747aa49b982667552513d220bd.tar.xz
Merge pull request #6483 from matrix-org/erikj/port_rest_v2
Port rest client v2_alpha to async/await
Diffstat (limited to 'synapse/rest/client/v2_alpha/sendtodevice.py')
-rw-r--r--synapse/rest/client/v2_alpha/sendtodevice.py9
1 files changed, 3 insertions, 6 deletions
diff --git a/synapse/rest/client/v2_alpha/sendtodevice.py b/synapse/rest/client/v2_alpha/sendtodevice.py
index d90e52ed1a..501b52fb6c 100644
--- a/synapse/rest/client/v2_alpha/sendtodevice.py
+++ b/synapse/rest/client/v2_alpha/sendtodevice.py
@@ -15,8 +15,6 @@
 
 import logging
 
-from twisted.internet import defer
-
 from synapse.http import servlet
 from synapse.http.servlet import parse_json_object_from_request
 from synapse.logging.opentracing import set_tag, trace
@@ -51,15 +49,14 @@ class SendToDeviceRestServlet(servlet.RestServlet):
             request, self._put, request, message_type, txn_id
         )
 
-    @defer.inlineCallbacks
-    def _put(self, request, message_type, txn_id):
-        requester = yield self.auth.get_user_by_req(request, allow_guest=True)
+    async def _put(self, request, message_type, txn_id):
+        requester = await self.auth.get_user_by_req(request, allow_guest=True)
 
         content = parse_json_object_from_request(request)
 
         sender_user_id = requester.user.to_string()
 
-        yield self.device_message_handler.send_device_message(
+        await self.device_message_handler.send_device_message(
             sender_user_id, message_type, content["messages"]
         )