mirror of
https://git.anonymousland.org/anonymousland/synapse-product.git
synced 2025-07-28 19:18:39 -04:00
Convert simple_select_one and simple_select_one_onecol to async (#8162)
This commit is contained in:
parent
56efa9ec71
commit
4c6c56dc58
25 changed files with 220 additions and 113 deletions
|
@ -17,7 +17,7 @@
|
|||
|
||||
import logging
|
||||
import re
|
||||
from typing import Awaitable, Dict, List, Optional
|
||||
from typing import Any, Awaitable, Dict, List, Optional
|
||||
|
||||
from synapse.api.constants import UserTypes
|
||||
from synapse.api.errors import Codes, StoreError, SynapseError, ThreepidValidationError
|
||||
|
@ -46,8 +46,8 @@ class RegistrationWorkerStore(SQLBaseStore):
|
|||
)
|
||||
|
||||
@cached()
|
||||
def get_user_by_id(self, user_id):
|
||||
return self.db_pool.simple_select_one(
|
||||
async def get_user_by_id(self, user_id: str) -> Optional[Dict[str, Any]]:
|
||||
return await self.db_pool.simple_select_one(
|
||||
table="users",
|
||||
keyvalues={"name": user_id},
|
||||
retcols=[
|
||||
|
@ -1259,12 +1259,12 @@ class RegistrationStore(RegistrationBackgroundUpdateStore):
|
|||
desc="del_user_pending_deactivation",
|
||||
)
|
||||
|
||||
def get_user_pending_deactivation(self):
|
||||
async def get_user_pending_deactivation(self) -> Optional[str]:
|
||||
"""
|
||||
Gets one user from the table of users waiting to be parted from all the rooms
|
||||
they're in.
|
||||
"""
|
||||
return self.db_pool.simple_select_one_onecol(
|
||||
return await self.db_pool.simple_select_one_onecol(
|
||||
"users_pending_deactivation",
|
||||
keyvalues={},
|
||||
retcol="user_id",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue