Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Commit 7aa5b84

Browse files
committed
Pull is_guest up into the RegistrationWorkerStore
1 parent 9daa8d3 commit 7aa5b84

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

synapse/storage/databases/main/registration.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1744,6 +1744,18 @@ def _replace_refresh_token_txn(txn: LoggingTransaction) -> None:
17441744
"replace_refresh_token", _replace_refresh_token_txn
17451745
)
17461746

1747+
@cached()
1748+
async def is_guest(self, user_id: str) -> bool:
1749+
res = await self.db_pool.simple_select_one_onecol(
1750+
table="users",
1751+
keyvalues={"name": user_id},
1752+
retcol="is_guest",
1753+
allow_none=True,
1754+
desc="is_guest",
1755+
)
1756+
1757+
return res if res else False
1758+
17471759

17481760
class RegistrationBackgroundUpdateStore(RegistrationWorkerStore):
17491761
def __init__(
@@ -1886,18 +1898,6 @@ def set_user_deactivated_status_txn(self, txn, user_id: str, deactivated: bool):
18861898
self._invalidate_cache_and_stream(txn, self.get_user_by_id, (user_id,))
18871899
txn.call_after(self.is_guest.invalidate, (user_id,))
18881900

1889-
@cached()
1890-
async def is_guest(self, user_id: str) -> bool:
1891-
res = await self.db_pool.simple_select_one_onecol(
1892-
table="users",
1893-
keyvalues={"name": user_id},
1894-
retcol="is_guest",
1895-
allow_none=True,
1896-
desc="is_guest",
1897-
)
1898-
1899-
return res if res else False
1900-
19011901

19021902
class RegistrationStore(StatsStore, RegistrationBackgroundUpdateStore):
19031903
def __init__(

0 commit comments

Comments
 (0)