summary refs log tree commit diff
path: root/synapse/storage/profile.py
diff options
context:
space:
mode:
authorBrendan Abolivier <babolivier@matrix.org>2019-06-13 18:10:14 +0100
committerGitHub <noreply@github.com>2019-06-13 18:10:14 +0100
commita6cf1e079e490cb67e43b82a7e1909e1208be9b2 (patch)
tree2bbd3cfcce476a0a0c43f6c5ca3f3545b63551b2 /synapse/storage/profile.py
parentRegenerate full schemas (diff)
parentLint (diff)
downloadsynapse-a6cf1e079e490cb67e43b82a7e1909e1208be9b2.tar.xz
Merge pull request #5416 from matrix-org/babolivier/fix_profile_replication
Add unique index to the profile_replication_status table.
Diffstat (limited to 'synapse/storage/profile.py')
-rw-r--r--synapse/storage/profile.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/synapse/storage/profile.py b/synapse/storage/profile.py

index 04908cbc35..f60263502b 100644 --- a/synapse/storage/profile.py +++ b/synapse/storage/profile.py
@@ -19,6 +19,7 @@ from twisted.internet import defer from synapse.api.errors import StoreError from synapse.storage.roommember import ProfileInfo +from . import background_updates from ._base import SQLBaseStore BATCH_SIZE = 100 @@ -165,7 +166,18 @@ class ProfileWorkerStore(SQLBaseStore): ) -class ProfileStore(ProfileWorkerStore): +class ProfileStore(ProfileWorkerStore, background_updates.BackgroundUpdateStore): + def __init__(self, db_conn, hs): + + super(ProfileStore, self).__init__(db_conn, hs) + + self.register_background_index_update( + "profile_replication_status_host_index", + index_name="profile_replication_status_idx", + table="profile_replication_status", + columns=["host"], + ) + def add_remote_profile_cache(self, user_id, displayname, avatar_url): """Ensure we are caching the remote user's profiles.