From 26db18bc90e745e1eb054e2ffd6969918a6253c4 Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Thu, 21 Apr 2016 17:45:56 +0100 Subject: [PATCH] Need to do _background_update_progress_txn in actual transaction --- synapse/storage/search.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/synapse/storage/search.py b/synapse/storage/search.py index 1baed674a..fd40b44a9 100644 --- a/synapse/storage/search.py +++ b/synapse/storage/search.py @@ -158,15 +158,17 @@ class SearchStore(BackgroundUpdateStore): ) conn.set_session(autocommit=False) - pg = dict(progress) - pg["have_added_indexes"] = True - - self._background_update_progress_txn( - conn.cursor(), self.EVENT_SEARCH_ORDER_UPDATE_NAME, progress - ) - yield self.runWithConnection(create_index) + pg = dict(progress) + pg["have_added_indexes"] = True + + yield self.runInteraction( + self.EVENT_SEARCH_ORDER_UPDATE_NAME, + self._background_update_progress_txn, + self.EVENT_SEARCH_ORDER_UPDATE_NAME, progress, + ) + INSERT_CLUMP_SIZE = 1000 def reindex_search_txn(txn):