0
0
Fork 1
mirror of https://mau.dev/maunium/synapse.git synced 2024-12-14 16:23:52 +01:00

Fix broken background updates when using sqlite with enable_search off (#12215)

Signed-off-by: Sean Quah <seanq@element.io>
This commit is contained in:
Sean Quah 2022-03-14 17:52:58 +00:00 committed by GitHub
parent 90b2327066
commit 8e5706d144
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 6 deletions

1
changelog.d/12215.bugfix Normal file
View file

@ -0,0 +1 @@
Fix a bug introduced in 1.54.0 that broke background updates on sqlite homeservers while search was disabled.

View file

@ -125,9 +125,6 @@ class SearchBackgroundUpdateStore(SearchWorkerStore):
):
super().__init__(database, db_conn, hs)
if not hs.config.server.enable_search:
return
self.db_pool.updates.register_background_update_handler(
self.EVENT_SEARCH_UPDATE_NAME, self._background_reindex_search
)
@ -243,9 +240,13 @@ class SearchBackgroundUpdateStore(SearchWorkerStore):
return len(event_search_rows)
result = await self.db_pool.runInteraction(
self.EVENT_SEARCH_UPDATE_NAME, reindex_search_txn
)
if self.hs.config.server.enable_search:
result = await self.db_pool.runInteraction(
self.EVENT_SEARCH_UPDATE_NAME, reindex_search_txn
)
else:
# Don't index anything if search is not enabled.
result = 0
if not result:
await self.db_pool.updates._end_background_update(