summary refs log tree commit diff
diff options
context:
space:
mode:
authorBrendan Abolivier <babolivier@matrix.org>2019-06-13 18:11:11 +0100
committerBrendan Abolivier <babolivier@matrix.org>2019-06-13 18:11:11 +0100
commitadf3eee668a935fed90f353954142827fc908a13 (patch)
tree5d3d1abf08d3c4ec5bade272df40fbb76c20d205
parentFix bogus changelog (diff)
parentLint (diff)
downloadsynapse-adf3eee668a935fed90f353954142827fc908a13.tar.xz
Merge branch 'babolivier/fix_profile_replication' into babolivier/userdir_hide_users
-rw-r--r--synapse/storage/profile.py14
-rw-r--r--synapse/storage/schema/delta/55/profile_replication_status_index.sql3
2 files changed, 15 insertions, 2 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.
 
diff --git a/synapse/storage/schema/delta/55/profile_replication_status_index.sql b/synapse/storage/schema/delta/55/profile_replication_status_index.sql
index 7c20cb5a44..18a0f7e10c 100644
--- a/synapse/storage/schema/delta/55/profile_replication_status_index.sql
+++ b/synapse/storage/schema/delta/55/profile_replication_status_index.sql
@@ -13,4 +13,5 @@
  * limitations under the License.
  */
 
-CREATE UNIQUE INDEX profile_replication_status_idx ON profile_replication_status(host);
+INSERT INTO background_updates (update_name, progress_json) VALUES
+  ('profile_replication_status_host_index', '{}');