Improve reliability of rebuilding the search index.

This commit is contained in:
Greyson Parrelli
2024-09-05 09:59:29 -04:00
committed by Alex Hart
parent 6682815663
commit 1aed8eefcd
3 changed files with 57 additions and 35 deletions

View File

@@ -22,7 +22,14 @@ internal class RebuildMessageSearchIndexMigrationJob(
override fun performMigration() {
val startTime = System.currentTimeMillis()
SignalDatabase.messageSearch.rebuildIndex()
val success = SignalDatabase.messageSearch.rebuildIndex()
if (!success) {
Log.w(TAG, "Failed to rebuild search index. Resetting tables. That will enqueue a job to reset the index as a side-effect.")
SignalDatabase.messageSearch.fullyResetTables()
}
Log.d(TAG, "It took ${System.currentTimeMillis() - startTime} ms to rebuild the search index.")
}