Convert _base, profile, and _receipts handlers to async/await (#7860)

This commit is contained in:
Patrick Cloke 2020-07-17 07:08:30 -04:00 committed by GitHub
parent fff483ea96
commit 6fca1b3506
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 53 additions and 59 deletions

View file

@ -488,11 +488,15 @@ class EventCreationHandler(object):
try:
if "displayname" not in content:
displayname = yield profile.get_displayname(target)
displayname = yield defer.ensureDeferred(
profile.get_displayname(target)
)
if displayname is not None:
content["displayname"] = displayname
if "avatar_url" not in content:
avatar_url = yield profile.get_avatar_url(target)
avatar_url = yield defer.ensureDeferred(
profile.get_avatar_url(target)
)
if avatar_url is not None:
content["avatar_url"] = avatar_url
except Exception as e: