summary refs log tree commit diff
path: root/synapse/storage/background_updates.py
diff options
context:
space:
mode:
authorRichard van der Hoff <richard@matrix.org>2018-02-02 14:32:51 +0000
committerRichard van der Hoff <richard@matrix.org>2018-02-02 14:32:51 +0000
commit6b02fc80d173d3d4de81623d411a136abe1637e9 (patch)
treebe205b82531cde6154a4f20ee84923282f595e83 /synapse/storage/background_updates.py
parentfix GIST->GIN switch (diff)
downloadsynapse-6b02fc80d173d3d4de81623d411a136abe1637e9.tar.xz
Reinstate event_search_postgres_gist handler
People may have queued updates for this, so we can't just delete it.
Diffstat (limited to 'synapse/storage/background_updates.py')
-rw-r--r--synapse/storage/background_updates.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/synapse/storage/background_updates.py b/synapse/storage/background_updates.py
index 11a1b942f1..c88759bf2c 100644
--- a/synapse/storage/background_updates.py
+++ b/synapse/storage/background_updates.py
@@ -242,6 +242,25 @@ class BackgroundUpdateStore(SQLBaseStore):
         """
         self._background_update_handlers[update_name] = update_handler
 
+    def register_noop_background_update(self, update_name):
+        """Register a noop handler for a background update.
+
+        This is useful when we previously did a background update, but no
+        longer wish to do the update. In this case the background update should
+        be removed from the schema delta files, but there may still be some
+        users who have the background update queued, so this method should
+        also be called to clear the update.
+
+        Args:
+            update_name (str): Name of update
+        """
+        @defer.inlineCallbacks
+        def noop_update(progress, batch_size):
+            yield self._end_background_update(update_name)
+            defer.returnValue(1)
+
+        self.register_background_update_handler(update_name, noop_update)
+
     def register_background_index_update(self, update_name, index_name,
                                          table, columns, where_clause=None,
                                          unique=False,