mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-08-15 12:25:33 -04:00
Port replication http server endpoints to async/await
This commit is contained in:
parent
561133c3c5
commit
e577a4b2ad
6 changed files with 26 additions and 44 deletions
|
@ -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
|
||||
)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue