mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-07 15:04:58 -04:00
Move additional tasks to the background worker, part 4 (#8513)
This commit is contained in:
parent
b2486f6656
commit
629a951b49
11 changed files with 199 additions and 224 deletions
|
@ -862,6 +862,32 @@ class RegistrationWorkerStore(SQLBaseStore):
|
|||
values={"expiration_ts_ms": expiration_ts, "email_sent": False},
|
||||
)
|
||||
|
||||
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 await self.db_pool.simple_select_one_onecol(
|
||||
"users_pending_deactivation",
|
||||
keyvalues={},
|
||||
retcol="user_id",
|
||||
allow_none=True,
|
||||
desc="get_users_pending_deactivation",
|
||||
)
|
||||
|
||||
async def del_user_pending_deactivation(self, user_id: str) -> None:
|
||||
"""
|
||||
Removes the given user to the table of users who need to be parted from all the
|
||||
rooms they're in, effectively marking that user as fully deactivated.
|
||||
"""
|
||||
# XXX: This should be simple_delete_one but we failed to put a unique index on
|
||||
# the table, so somehow duplicate entries have ended up in it.
|
||||
await self.db_pool.simple_delete(
|
||||
"users_pending_deactivation",
|
||||
keyvalues={"user_id": user_id},
|
||||
desc="del_user_pending_deactivation",
|
||||
)
|
||||
|
||||
|
||||
class RegistrationBackgroundUpdateStore(RegistrationWorkerStore):
|
||||
def __init__(self, database: DatabasePool, db_conn, hs):
|
||||
|
@ -1371,32 +1397,6 @@ class RegistrationStore(RegistrationBackgroundUpdateStore):
|
|||
desc="add_user_pending_deactivation",
|
||||
)
|
||||
|
||||
async def del_user_pending_deactivation(self, user_id: str) -> None:
|
||||
"""
|
||||
Removes the given user to the table of users who need to be parted from all the
|
||||
rooms they're in, effectively marking that user as fully deactivated.
|
||||
"""
|
||||
# XXX: This should be simple_delete_one but we failed to put a unique index on
|
||||
# the table, so somehow duplicate entries have ended up in it.
|
||||
await self.db_pool.simple_delete(
|
||||
"users_pending_deactivation",
|
||||
keyvalues={"user_id": user_id},
|
||||
desc="del_user_pending_deactivation",
|
||||
)
|
||||
|
||||
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 await self.db_pool.simple_select_one_onecol(
|
||||
"users_pending_deactivation",
|
||||
keyvalues={},
|
||||
retcol="user_id",
|
||||
allow_none=True,
|
||||
desc="get_users_pending_deactivation",
|
||||
)
|
||||
|
||||
async def validate_threepid_session(
|
||||
self, session_id: str, client_secret: str, token: str, current_ts: int
|
||||
) -> Optional[str]:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue