diff options
author | Erik Johnston <erik@matrix.org> | 2020-05-22 13:41:11 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-22 13:41:11 +0100 |
commit | 06a02bc1ce9ef23a6dff28dbfd30f910ae330b1d (patch) | |
tree | f814615713b930736b936395a1ad391ff6efb82b /synapse/handlers | |
parent | Use a non-empty RelayState for user interactive auth with SAML. (#7552) (diff) | |
download | synapse-06a02bc1ce9ef23a6dff28dbfd30f910ae330b1d.tar.xz |
Convert sending mail to async/await. (#7557)
Mainly because sometimes the email push code raises exceptions where the stack traces have gotten lost, which is hopefully fixed by this.
Diffstat (limited to 'synapse/handlers')
-rw-r--r-- | synapse/handlers/identity.py | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/synapse/handlers/identity.py b/synapse/handlers/identity.py index 0f0e632b62..9ed0d23b0f 100644 --- a/synapse/handlers/identity.py +++ b/synapse/handlers/identity.py @@ -290,8 +290,7 @@ class IdentityHandler(BaseHandler): return changed - @defer.inlineCallbacks - def send_threepid_validation( + async def send_threepid_validation( self, email_address, client_secret, @@ -319,7 +318,7 @@ class IdentityHandler(BaseHandler): """ # Check that this email/client_secret/send_attempt combo is new or # greater than what we've seen previously - session = yield self.store.get_threepid_validation_session( + session = await self.store.get_threepid_validation_session( "email", client_secret, address=email_address, validated=False ) @@ -353,7 +352,7 @@ class IdentityHandler(BaseHandler): # Send the mail with the link containing the token, client_secret # and session_id try: - yield send_email_func(email_address, token, client_secret, session_id) + await send_email_func(email_address, token, client_secret, session_id) except Exception: logger.exception( "Error sending threepid validation email to %s", email_address @@ -364,7 +363,7 @@ class IdentityHandler(BaseHandler): self.hs.clock.time_msec() + self.hs.config.email_validation_token_lifetime ) - yield self.store.start_or_continue_validation_session( + await self.store.start_or_continue_validation_session( "email", email_address, session_id, |