summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthew Hodgson <matthew@matrix.org>2018-05-04 01:46:26 +0100
committerMatthew Hodgson <matthew@matrix.org>2018-05-04 01:46:26 +0100
commitfb47ce3e6af06c36bd8c430d79801307814d5909 (patch)
tree6566a95b294dbf62254883fa07f8d26ef8b1c526
parentfix user in user regexp (diff)
downloadsynapse-fb47ce3e6af06c36bd8c430d79801307814d5909.tar.xz
make set_profile_* an upsert rather than update, now create_profile is gone
-rw-r--r--synapse/storage/profile.py17
1 files changed, 6 insertions, 11 deletions
diff --git a/synapse/storage/profile.py b/synapse/storage/profile.py

index fcf3af7e5b..da1db0ebae 100644 --- a/synapse/storage/profile.py +++ b/synapse/storage/profile.py
@@ -125,33 +125,28 @@ class ProfileWorkerStore(SQLBaseStore): class ProfileStore(ProfileWorkerStore): - def create_profile(self, user_localpart): - return self._simple_insert( - table="profiles", - values={"user_id": user_localpart}, - desc="create_profile", - ) - def set_profile_displayname(self, user_localpart, new_displayname, batchnum): - return self._simple_update_one( + return self._simple_upsert( table="profiles", keyvalues={"user_id": user_localpart}, - updatevalues={ + values={ "displayname": new_displayname, "batch": batchnum, }, desc="set_profile_displayname", + lock=False # we can do this because user_id has a unique index ) def set_profile_avatar_url(self, user_localpart, new_avatar_url, batchnum): - return self._simple_update_one( + return self._simple_upsert( table="profiles", keyvalues={"user_id": user_localpart}, - updatevalues={ + values={ "avatar_url": new_avatar_url, "batch": batchnum, }, desc="set_profile_avatar_url", + lock=False # we can do this because user_id has a unique index ) def add_remote_profile_cache(self, user_id, displayname, avatar_url):