summary refs log tree commit diff
path: root/synapse/replication/http/register.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2019-10-29 13:00:51 +0000
committerErik Johnston <erik@matrix.org>2019-10-29 13:00:51 +0000
commite577a4b2ad01233ed70b3ab0a9e52aab42e88231 (patch)
treecff16626eb9135baffe1874576d4145b2664b883 /synapse/replication/http/register.py
parentMerge pull request #6263 from matrix-org/erikj/caches_return_deferreds (diff)
downloadsynapse-e577a4b2ad01233ed70b3ab0a9e52aab42e88231.tar.xz
Port replication http server endpoints to async/await
Diffstat (limited to 'synapse/replication/http/register.py')
-rw-r--r--synapse/replication/http/register.py12
1 files changed, 4 insertions, 8 deletions
diff --git a/synapse/replication/http/register.py b/synapse/replication/http/register.py
index 38260256cf..915cfb9430 100644
--- a/synapse/replication/http/register.py
+++ b/synapse/replication/http/register.py
@@ -15,8 +15,6 @@
 
 import logging
 
-from twisted.internet import defer
-
 from synapse.http.servlet import parse_json_object_from_request
 from synapse.replication.http._base import ReplicationEndpoint
 
@@ -74,11 +72,10 @@ class ReplicationRegisterServlet(ReplicationEndpoint):
             "address": address,
         }
 
-    @defer.inlineCallbacks
-    def _handle_request(self, request, user_id):
+    async def _handle_request(self, request, user_id):
         content = parse_json_object_from_request(request)
 
-        yield self.registration_handler.register_with_store(
+        await self.registration_handler.register_with_store(
             user_id=user_id,
             password_hash=content["password_hash"],
             was_guest=content["was_guest"],
@@ -117,14 +114,13 @@ class ReplicationPostRegisterActionsServlet(ReplicationEndpoint):
         """
         return {"auth_result": auth_result, "access_token": access_token}
 
-    @defer.inlineCallbacks
-    def _handle_request(self, request, user_id):
+    async def _handle_request(self, request, user_id):
         content = parse_json_object_from_request(request)
 
         auth_result = content["auth_result"]
         access_token = content["access_token"]
 
-        yield self.registration_handler.post_registration_actions(
+        await self.registration_handler.post_registration_actions(
             user_id=user_id, auth_result=auth_result, access_token=access_token
         )