Convert calls of async database methods to async (#8166)

This commit is contained in:
Patrick Cloke 2020-08-27 13:38:41 -04:00 committed by GitHub
parent c9fa696ea2
commit 9b7ac03af3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 114 additions and 84 deletions

View file

@ -16,7 +16,7 @@
import logging
from itertools import chain
from typing import Tuple
from typing import Any, Dict, Tuple
from twisted.internet.defer import DeferredLock
@ -222,11 +222,11 @@ class StatsStore(StateDeltasStore):
desc="stats_incremental_position",
)
def update_room_state(self, room_id, fields):
async def update_room_state(self, room_id: str, fields: Dict[str, Any]) -> None:
"""
Args:
room_id (str)
fields (dict[str:Any])
room_id
fields
"""
# For whatever reason some of the fields may contain null bytes, which
@ -244,7 +244,7 @@ class StatsStore(StateDeltasStore):
if field and "\0" in field:
fields[col] = None
return self.db_pool.simple_upsert(
await self.db_pool.simple_upsert(
table="room_stats_state",
keyvalues={"room_id": room_id},
values=fields,