summary refs log tree commit diff
path: root/synapse/storage/event_push_actions.py
diff options
context:
space:
mode:
Diffstat (limited to 'synapse/storage/event_push_actions.py')
-rw-r--r--synapse/storage/event_push_actions.py28
1 files changed, 4 insertions, 24 deletions
diff --git a/synapse/storage/event_push_actions.py b/synapse/storage/event_push_actions.py
index 40bfe754b5..7974a108ad 100644
--- a/synapse/storage/event_push_actions.py
+++ b/synapse/storage/event_push_actions.py
@@ -33,9 +33,11 @@ class EventPushActionsStore(SQLBaseStore):
         self.stream_ordering_month_ago = None
         super(EventPushActionsStore, self).__init__(hs)
 
-        self.register_background_update_handler(
+        self.register_background_index_update(
             self.EPA_HIGHLIGHT_INDEX,
-            self._background_index_epa_highlight,
+            index_name="event_push_actions_u_highlight",
+            table="event_push_actions",
+            columns=["user_id", "highlight", "stream_ordering"],
         )
 
     def _set_push_actions_for_event_and_users_txn(self, txn, event, tuples):
@@ -508,28 +510,6 @@ class EventPushActionsStore(SQLBaseStore):
 
         return range_end
 
-    @defer.inlineCallbacks
-    def _background_index_epa_highlight(self, progress, batch_size):
-        def reindex_txn(txn):
-            if isinstance(self.database_engine, PostgresEngine):
-                txn.execute(
-                    "CREATE INDEX CONCURRENTLY event_push_actions_u_highlight"
-                    " on event_push_actions(user_id, highlight, stream_ordering)"
-                )
-            else:
-                txn.execute(
-                    "CREATE INDEX event_push_actions_u_highlight"
-                    " on event_push_actions(user_id, highlight, stream_ordering)"
-                )
-
-        yield self.runInteraction(
-            self.EPA_HIGHLIGHT_INDEX, reindex_txn
-        )
-
-        yield self._end_background_update(self.EPA_HIGHLIGHT_INDEX)
-
-        defer.returnValue(1)
-
 
 def _action_has_highlight(actions):
     for action in actions: