diff options
author | Patrick Cloke <clokep@users.noreply.github.com> | 2020-08-27 07:08:38 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-27 07:08:38 -0400 |
commit | 4a739c73b404284253a548f60197e70c6c385645 (patch) | |
tree | 6521f9d972250b5bf50748b691a54c0a7e9d0282 /synapse/storage/databases/main/profile.py | |
parent | Reduce run-times of tests by advancing the reactor less (#7757) (diff) | |
download | synapse-4a739c73b404284253a548f60197e70c6c385645.tar.xz |
Convert simple_update* and simple_select* to async (#8173)
Diffstat (limited to 'synapse/storage/databases/main/profile.py')
-rw-r--r-- | synapse/storage/databases/main/profile.py | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/synapse/storage/databases/main/profile.py b/synapse/storage/databases/main/profile.py index b8233c4848..858fd92420 100644 --- a/synapse/storage/databases/main/profile.py +++ b/synapse/storage/databases/main/profile.py @@ -71,16 +71,20 @@ class ProfileWorkerStore(SQLBaseStore): table="profiles", values={"user_id": user_localpart}, desc="create_profile" ) - def set_profile_displayname(self, user_localpart, new_displayname): - return self.db_pool.simple_update_one( + async def set_profile_displayname( + self, user_localpart: str, new_displayname: str + ) -> None: + await self.db_pool.simple_update_one( table="profiles", keyvalues={"user_id": user_localpart}, updatevalues={"displayname": new_displayname}, desc="set_profile_displayname", ) - def set_profile_avatar_url(self, user_localpart, new_avatar_url): - return self.db_pool.simple_update_one( + async def set_profile_avatar_url( + self, user_localpart: str, new_avatar_url: str + ) -> None: + await self.db_pool.simple_update_one( table="profiles", keyvalues={"user_id": user_localpart}, updatevalues={"avatar_url": new_avatar_url}, @@ -106,8 +110,10 @@ class ProfileStore(ProfileWorkerStore): desc="add_remote_profile_cache", ) - def update_remote_profile_cache(self, user_id, displayname, avatar_url): - return self.db_pool.simple_update( + async def update_remote_profile_cache( + self, user_id: str, displayname: str, avatar_url: str + ) -> int: + return await self.db_pool.simple_update( table="remote_profile_cache", keyvalues={"user_id": user_id}, updatevalues={ |