Convert additional database stores to async/await (#8045)

This commit is contained in:
Patrick Cloke 2020-08-07 12:17:17 -04:00 committed by GitHub
parent 1048ed2afa
commit f3fe6961b2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 107 additions and 152 deletions

View file

@ -15,8 +15,6 @@
from unpaddedbase64 import encode_base64
from twisted.internet import defer
from synapse.storage._base import SQLBaseStore
from synapse.util.caches.descriptors import cached, cachedList
@ -40,9 +38,8 @@ class SignatureWorkerStore(SQLBaseStore):
return self.db_pool.runInteraction("get_event_reference_hashes", f)
@defer.inlineCallbacks
def add_event_hashes(self, event_ids):
hashes = yield self.get_event_reference_hashes(event_ids)
async def add_event_hashes(self, event_ids):
hashes = await self.get_event_reference_hashes(event_ids)
hashes = {
e_id: {k: encode_base64(v) for k, v in h.items() if k == "sha256"}
for e_id, h in hashes.items()