diff options
author | Patrick Cloke <clokep@users.noreply.github.com> | 2020-08-27 13:38:41 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-27 13:38:41 -0400 |
commit | 9b7ac03af3e7ceae7d1933db566ee407cfdef72d (patch) | |
tree | bd29b6da47cb08b846e05ce004f0e8d4008ed374 /synapse/storage/databases/main/keys.py | |
parent | simple_search_list_txn should return None, not 0. (#8187) (diff) | |
download | synapse-9b7ac03af3e7ceae7d1933db566ee407cfdef72d.tar.xz |
Convert calls of async database methods to async (#8166)
Diffstat (limited to 'synapse/storage/databases/main/keys.py')
-rw-r--r-- | synapse/storage/databases/main/keys.py | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/synapse/storage/databases/main/keys.py b/synapse/storage/databases/main/keys.py index fadcad51e7..1c0a049c55 100644 --- a/synapse/storage/databases/main/keys.py +++ b/synapse/storage/databases/main/keys.py @@ -140,22 +140,28 @@ class KeyStore(SQLBaseStore): for i in invalidations: invalidate((i,)) - def store_server_keys_json( - self, server_name, key_id, from_server, ts_now_ms, ts_expires_ms, key_json_bytes - ): + async def store_server_keys_json( + self, + server_name: str, + key_id: str, + from_server: str, + ts_now_ms: int, + ts_expires_ms: int, + key_json_bytes: bytes, + ) -> None: """Stores the JSON bytes for a set of keys from a server The JSON should be signed by the originating server, the intermediate server, and by this server. Updates the value for the (server_name, key_id, from_server) triplet if one already existed. Args: - server_name (str): The name of the server. - key_id (str): The identifer of the key this JSON is for. - from_server (str): The server this JSON was fetched from. - ts_now_ms (int): The time now in milliseconds. - ts_valid_until_ms (int): The time when this json stops being valid. - key_json (bytes): The encoded JSON. + server_name: The name of the server. + key_id: The identifer of the key this JSON is for. + from_server: The server this JSON was fetched from. + ts_now_ms: The time now in milliseconds. + ts_valid_until_ms: The time when this json stops being valid. + key_json_bytes: The encoded JSON. """ - return self.db_pool.simple_upsert( + await self.db_pool.simple_upsert( table="server_keys_json", keyvalues={ "server_name": server_name, |