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

@ -15,8 +15,6 @@
import logging
from twisted.internet import defer
import synapse.state
import synapse.storage
import synapse.types
@ -66,8 +64,7 @@ class BaseHandler(object):
self.event_builder_factory = hs.get_event_builder_factory()
@defer.inlineCallbacks
def ratelimit(self, requester, update=True, is_admin_redaction=False):
async def ratelimit(self, requester, update=True, is_admin_redaction=False):
"""Ratelimits requests.
Args:
@ -99,7 +96,7 @@ class BaseHandler(object):
burst_count = self._rc_message.burst_count
# Check if there is a per user override in the DB.
override = yield self.store.get_ratelimit_for_user(user_id)
override = await self.store.get_ratelimit_for_user(user_id)
if override:
# If overridden with a null Hz then ratelimiting has been entirely
# disabled for the user