Convert additional databases to async/await part 2 (#8200)

This commit is contained in:
Patrick Cloke 2020-09-01 08:39:04 -04:00 committed by GitHub
parent bbb3c8641c
commit da77520cd1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 111 additions and 81 deletions

View file

@ -1,3 +1,5 @@
from typing import Optional
from synapse.storage._base import SQLBaseStore
@ -15,7 +17,9 @@ class OpenIdStore(SQLBaseStore):
desc="insert_open_id_token",
)
def get_user_id_for_open_id_token(self, token, ts_now_ms):
async def get_user_id_for_open_id_token(
self, token: str, ts_now_ms: int
) -> Optional[str]:
def get_user_id_for_token_txn(txn):
sql = (
"SELECT user_id FROM open_id_tokens"
@ -30,6 +34,6 @@ class OpenIdStore(SQLBaseStore):
else:
return rows[0][0]
return self.db_pool.runInteraction(
return await self.db_pool.runInteraction(
"get_user_id_for_token", get_user_id_for_token_txn
)