Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move rest/admin to use async/await. #6196

Merged
merged 9 commits into from Oct 18, 2019

Conversation

@erikjohnston
Copy link
Member

erikjohnston commented Oct 11, 2019

Based on #6195

Copy link
Member

richvdh left a comment

looks good otherwise, though it's going to conflict with #5742 and #5925 :(

synapse/rest/admin/__init__.py Outdated Show resolved Hide resolved
synapse/rest/admin/__init__.py Outdated Show resolved Hide resolved
@erikjohnston erikjohnston requested a review from matrix-org/synapse-core Oct 11, 2019


@defer.inlineCallbacks
def assert_user_is_admin(auth, user_id):
async def assert_user_is_admin(auth, user_id):
"""Verify that the given user is an admin user
WARNING: MAKE SURE YOU YIELD ON THE RESULT!

This comment has been minimized.

Copy link
@richvdh

richvdh Oct 11, 2019

Member

... or await

Copy link
Member

richvdh left a comment

lgtm



@attr.s(slots=True, frozen=True)
class DoneAwaitable(object):

This comment has been minimized.

Copy link
@hawkowl

hawkowl Oct 14, 2019

Contributor

can you not use twisted.internet.defer.succeed?

This comment has been minimized.

Copy link
@erikjohnston

erikjohnston Oct 18, 2019

Author Member

Oh, hmm, true. Though given I've written it now and this is (presumably?) pretty fast I think I might leave it for now.

@erikjohnston erikjohnston merged commit d98029e into develop Oct 18, 2019
18 checks passed
18 checks passed
buildkite/synapse Build #4938 passed (20 minutes, 2 seconds)
Details
buildkite/synapse/check-sample-config Passed (1 minute, 50 seconds)
Details
buildkite/synapse/check-style Passed (1 minute, 47 seconds)
Details
buildkite/synapse/isort Passed (20 seconds)
Details
buildkite/synapse/mypy Passed (21 seconds)
Details
buildkite/synapse/newspaper-newsfile Passed (14 seconds)
Details
buildkite/synapse/packaging Passed (19 seconds)
Details
buildkite/synapse/pipeline Passed (3 seconds)
Details
buildkite/synapse/python-3-dot-5-slash-postgres-9-dot-5 Passed (18 minutes, 5 seconds)
Details
buildkite/synapse/python-3-dot-5-slash-sqlite Passed (7 minutes, 1 second)
Details
buildkite/synapse/python-3-dot-5-slash-sqlite-slash-old-deps Passed (8 minutes, 17 seconds)
Details
buildkite/synapse/python-3-dot-6-slash-sqlite Passed (5 minutes, 44 seconds)
Details
buildkite/synapse/python-3-dot-7-slash-postgres-11 Passed (17 minutes, 23 seconds)
Details
buildkite/synapse/python-3-dot-7-slash-postgres-9-dot-5 Passed (17 minutes, 10 seconds)
Details
buildkite/synapse/python-3-dot-7-slash-sqlite Passed (6 minutes, 16 seconds)
Details
buildkite/synapse/sytest-python-3-dot-5-slash-postgres-9-dot-6-slash-monolith Passed (16 minutes, 35 seconds)
Details
buildkite/synapse/sytest-python-3-dot-5-slash-postgres-9-dot-6-slash-workers Passed (14 minutes, 23 seconds)
Details
buildkite/synapse/sytest-python-3-dot-5-slash-sqlite-slash-monolith Passed (14 minutes, 30 seconds)
Details
@erikjohnston erikjohnston referenced this pull request Oct 18, 2019
3 of 3 tasks complete
@hawkowl hawkowl deleted the erikj/await branch Oct 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.