diff options
author | Amber Brown <hawkowl@atleastfornow.net> | 2019-07-01 23:33:52 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-01 23:33:52 +1000 |
commit | b4914681a5d42b9f1407c41fd2b7518b75d88ec4 (patch) | |
tree | 8ed21376f39d36313a3e85fe754a1cdcd771eb92 | |
parent | Merge pull request #5507 from matrix-org/erikj/presence_sync_tighloop (diff) | |
download | synapse-b4914681a5d42b9f1407c41fd2b7518b75d88ec4.tar.xz |
fix async/await consentresource (#5585)
Fixes #5582
-rw-r--r-- | changelog.d/5585.misc | 1 | ||||
-rw-r--r-- | synapse/rest/consent/consent_resource.py | 4 |
2 files changed, 4 insertions, 1 deletions
diff --git a/changelog.d/5585.misc b/changelog.d/5585.misc new file mode 100644 index 0000000000..6be06d4d0b --- /dev/null +++ b/changelog.d/5585.misc @@ -0,0 +1 @@ +Synapse can now handle RestServlets that return coroutines. diff --git a/synapse/rest/consent/consent_resource.py b/synapse/rest/consent/consent_resource.py index 624c42441e..1ddf9997ff 100644 --- a/synapse/rest/consent/consent_resource.py +++ b/synapse/rest/consent/consent_resource.py @@ -23,6 +23,8 @@ from six.moves import http_client import jinja2 from jinja2 import TemplateNotFound +from twisted.internet import defer + from synapse.api.errors import NotFoundError, StoreError, SynapseError from synapse.config import ConfigError from synapse.http.server import ( @@ -139,7 +141,7 @@ class ConsentResource(DirectServeResource): else: qualified_user_id = UserID(username, self.hs.hostname).to_string() - u = await self.store.get_user_by_id(qualified_user_id) + u = await defer.maybeDeferred(self.store.get_user_by_id, qualified_user_id) if u is None: raise NotFoundError("Unknown user") |