Convert simple_select_one and simple_select_one_onecol to async (#8162)

This commit is contained in:
Patrick Cloke 2020-08-26 07:19:32 -04:00 committed by GitHub
parent 56efa9ec71
commit 4c6c56dc58
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
25 changed files with 220 additions and 113 deletions

View file

@ -119,19 +119,19 @@ class EventsWorkerStore(SQLBaseStore):
super().process_replication_rows(stream_name, instance_name, token, rows)
def get_received_ts(self, event_id):
async def get_received_ts(self, event_id: str) -> Optional[int]:
"""Get received_ts (when it was persisted) for the event.
Raises an exception for unknown events.
Args:
event_id (str)
event_id: The event ID to query.
Returns:
Deferred[int|None]: Timestamp in milliseconds, or None for events
that were persisted before received_ts was implemented.
Timestamp in milliseconds, or None for events that were persisted
before received_ts was implemented.
"""
return self.db_pool.simple_select_one_onecol(
return await self.db_pool.simple_select_one_onecol(
table="events",
keyvalues={"event_id": event_id},
retcol="received_ts",