summary refs log tree commit diff
path: root/synapse/storage/databases/main/profile.py
diff options
context:
space:
mode:
authorAndrew Morgan <andrew@amorgan.xyz>2020-10-20 17:41:11 +0100
committerAndrew Morgan <andrew@amorgan.xyz>2020-10-20 17:41:11 +0100
commitec50c996099af2f23964ca2fbcd0b3ae304e4852 (patch)
tree4e39fd8acb5e467c8ab256a24f5be24fe34343dd /synapse/storage/databases/main/profile.py
parentMerge commit '30426c706' into anoa/dinsic_release_1_21_x (diff)
parentConvert calls of async database methods to async (#8166) (diff)
downloadsynapse-ec50c996099af2f23964ca2fbcd0b3ae304e4852.tar.xz
Merge commit '9b7ac03af' into anoa/dinsic_release_1_21_x
* commit '9b7ac03af':
  Convert calls of async database methods to async (#8166)
  simple_search_list_txn should return None, not 0. (#8187)
  Fix missing _add_persisted_position (#8179)
Diffstat (limited to 'synapse/storage/databases/main/profile.py')
-rw-r--r--synapse/storage/databases/main/profile.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/synapse/storage/databases/main/profile.py b/synapse/storage/databases/main/profile.py

index 5069f820bd..8b50e00553 100644 --- a/synapse/storage/databases/main/profile.py +++ b/synapse/storage/databases/main/profile.py
@@ -125,8 +125,8 @@ class ProfileWorkerStore(SQLBaseStore): desc="get_from_remote_profile_cache", ) - def create_profile(self, user_localpart): - return self.db_pool.simple_insert( + async def create_profile(self, user_localpart: str) -> None: + await self.db_pool.simple_insert( table="profiles", values={"user_id": user_localpart}, desc="create_profile" ) @@ -197,8 +197,7 @@ class ProfileWorkerStore(SQLBaseStore): class ProfileStore(ProfileWorkerStore): def __init__(self, database, db_conn, hs): - - super(ProfileStore, self).__init__(database, db_conn, hs) + super().__init__(database, db_conn, hs) self.db_pool.updates.register_background_index_update( "profile_replication_status_host_index", @@ -208,13 +207,15 @@ class ProfileStore(ProfileWorkerStore): unique=True, ) - def add_remote_profile_cache(self, user_id, displayname, avatar_url): + async def add_remote_profile_cache( + self, user_id: str, displayname: str, avatar_url: str + ) -> None: """Ensure we are caching the remote user's profiles. This should only be called when `is_subscribed_remote_profile_for_user` would return true for the user. """ - return self.db_pool.simple_upsert( + await self.db_pool.simple_upsert( table="remote_profile_cache", keyvalues={"user_id": user_id}, values={