Re-enable FTS optimization after deletes.
This commit is contained in:
parent
dda5037429
commit
afbce6f800
2 changed files with 13 additions and 12 deletions
|
@ -1533,12 +1533,11 @@ public class MessageTable extends DatabaseTable implements MessageTypes, Recipie
|
|||
return releaseChannelThreadId;
|
||||
}
|
||||
|
||||
public void deleteGroupStoryReplies(long parentStoryId) {
|
||||
private void deleteGroupStoryReplies(long parentStoryId) {
|
||||
SQLiteDatabase db = databaseHelper.getSignalWritableDatabase();
|
||||
String[] args = SqlUtil.buildArgs(parentStoryId);
|
||||
|
||||
db.delete(TABLE_NAME, PARENT_STORY_ID + " = ?", args);
|
||||
OptimizeMessageSearchIndexJob.enqueue();
|
||||
}
|
||||
|
||||
public int deleteStoriesOlderThan(long timestamp, boolean hasSeenReleaseChannelStories) {
|
||||
|
@ -1940,6 +1939,8 @@ public class MessageTable extends DatabaseTable implements MessageTypes, Recipie
|
|||
db.endTransaction();
|
||||
}
|
||||
|
||||
OptimizeMessageSearchIndexJob.enqueue();
|
||||
|
||||
ApplicationDependencies.getDatabaseObserver().notifyMessageUpdateObservers(new MessageId(messageId));
|
||||
ApplicationDependencies.getDatabaseObserver().notifyConversationListListeners();
|
||||
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
package org.thoughtcrime.securesms.jobs
|
||||
|
||||
import org.thoughtcrime.securesms.database.SignalDatabase
|
||||
import org.thoughtcrime.securesms.dependencies.ApplicationDependencies
|
||||
import org.thoughtcrime.securesms.jobmanager.Data
|
||||
import org.thoughtcrime.securesms.jobmanager.Job
|
||||
import org.thoughtcrime.securesms.transport.RetryLaterException
|
||||
import java.lang.Exception
|
||||
import kotlin.time.Duration.Companion.minutes
|
||||
import kotlin.time.Duration.Companion.seconds
|
||||
|
||||
/**
|
||||
* Optimizes the message search index incrementally.
|
||||
|
@ -16,8 +18,7 @@ class OptimizeMessageSearchIndexJob private constructor(parameters: Parameters)
|
|||
|
||||
@JvmStatic
|
||||
fun enqueue() {
|
||||
// TODO [greyson] Temporarily disabled until we can figure out what to do.
|
||||
// ApplicationDependencies.getJobManager().add(OptimizeMessageSearchIndexJob())
|
||||
ApplicationDependencies.getJobManager().add(OptimizeMessageSearchIndexJob())
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -33,15 +34,14 @@ class OptimizeMessageSearchIndexJob private constructor(parameters: Parameters)
|
|||
override fun getFactoryKey() = KEY
|
||||
override fun onFailure() = Unit
|
||||
override fun onShouldRetry(e: Exception) = e is RetryLaterException
|
||||
override fun getNextRunAttemptBackoff(pastAttemptCount: Int, exception: Exception): Long = 1.minutes.inWholeMilliseconds
|
||||
override fun getNextRunAttemptBackoff(pastAttemptCount: Int, exception: Exception): Long = 30.seconds.inWholeMilliseconds
|
||||
|
||||
override fun onRun() {
|
||||
// TODO [greyson] Temporarily disabled until we can figure out what to do.
|
||||
// val success = SignalDatabase.messageSearch.optimizeIndex(10.seconds.inWholeMilliseconds)
|
||||
//
|
||||
// if (!success) {
|
||||
// throw RetryLaterException()
|
||||
// }
|
||||
val success = SignalDatabase.messageSearch.optimizeIndex(5.seconds.inWholeMilliseconds)
|
||||
|
||||
if (!success) {
|
||||
throw RetryLaterException()
|
||||
}
|
||||
}
|
||||
|
||||
class Factory : Job.Factory<OptimizeMessageSearchIndexJob> {
|
||||
|
|
Loading…
Add table
Reference in a new issue