mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-25 19:29:54 +01:00
Improve reliability of rebuilding the search index.
This commit is contained in:
committed by
Alex Hart
parent
6682815663
commit
1aed8eefcd
@@ -7,7 +7,6 @@ import org.thoughtcrime.securesms.jobmanager.Job
|
||||
import org.thoughtcrime.securesms.jobmanager.impl.DataRestoreConstraint
|
||||
import org.thoughtcrime.securesms.transport.RetryLaterException
|
||||
import java.lang.Exception
|
||||
import java.lang.IllegalStateException
|
||||
import kotlin.time.Duration.Companion.seconds
|
||||
|
||||
class RebuildMessageSearchIndexJob private constructor(params: Parameters) : BaseJob(params) {
|
||||
@@ -37,10 +36,11 @@ class RebuildMessageSearchIndexJob private constructor(params: Parameters) : Bas
|
||||
override fun onFailure() = Unit
|
||||
|
||||
override fun onRun() {
|
||||
try {
|
||||
SignalDatabase.messageSearch.rebuildIndex()
|
||||
} catch (e: IllegalStateException) {
|
||||
throw RetryLaterException(e)
|
||||
val success = SignalDatabase.messageSearch.rebuildIndex()
|
||||
|
||||
if (!success) {
|
||||
Log.w(TAG, "Failed to rebuild search index. Resetting tables. That will enqueue another copy of this job as a side-effect.")
|
||||
SignalDatabase.messageSearch.fullyResetTables()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user