diff options
author | Patrick Cloke <clokep@users.noreply.github.com> | 2020-08-06 08:30:06 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-06 08:30:06 -0400 |
commit | d4a7829b12197faf52eb487c443ee09acafeb37e (patch) | |
tree | cab5f15a7532596153f61b47aafcf4cb4a4b7d45 /synapse/module_api/__init__.py | |
parent | Convert run_as_background_process inner function to async. (#8032) (diff) | |
download | synapse-d4a7829b12197faf52eb487c443ee09acafeb37e.tar.xz |
Convert synapse.api to async/await (#8031)
Diffstat (limited to 'synapse/module_api/__init__.py')
-rw-r--r-- | synapse/module_api/__init__.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/synapse/module_api/__init__.py b/synapse/module_api/__init__.py index 8201849951..c2fb757d9a 100644 --- a/synapse/module_api/__init__.py +++ b/synapse/module_api/__init__.py @@ -194,12 +194,16 @@ class ModuleApi(object): synapse.api.errors.AuthError: the access token is invalid """ # see if the access token corresponds to a device - user_info = yield self._auth.get_user_by_access_token(access_token) + user_info = yield defer.ensureDeferred( + self._auth.get_user_by_access_token(access_token) + ) device_id = user_info.get("device_id") user_id = user_info["user"].to_string() if device_id: # delete the device, which will also delete its access tokens - yield self._hs.get_device_handler().delete_device(user_id, device_id) + yield defer.ensureDeferred( + self._hs.get_device_handler().delete_device(user_id, device_id) + ) else: # no associated device. Just delete the access token. yield defer.ensureDeferred( |