kopia lustrzana https://github.com/ryukoposting/Signal-Android
Re-enable FTS optimization after deletes.
rodzic
dda5037429
commit
afbce6f800
|
@ -1533,12 +1533,11 @@ public class MessageTable extends DatabaseTable implements MessageTypes, Recipie
|
||||||
return releaseChannelThreadId;
|
return releaseChannelThreadId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void deleteGroupStoryReplies(long parentStoryId) {
|
private void deleteGroupStoryReplies(long parentStoryId) {
|
||||||
SQLiteDatabase db = databaseHelper.getSignalWritableDatabase();
|
SQLiteDatabase db = databaseHelper.getSignalWritableDatabase();
|
||||||
String[] args = SqlUtil.buildArgs(parentStoryId);
|
String[] args = SqlUtil.buildArgs(parentStoryId);
|
||||||
|
|
||||||
db.delete(TABLE_NAME, PARENT_STORY_ID + " = ?", args);
|
db.delete(TABLE_NAME, PARENT_STORY_ID + " = ?", args);
|
||||||
OptimizeMessageSearchIndexJob.enqueue();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int deleteStoriesOlderThan(long timestamp, boolean hasSeenReleaseChannelStories) {
|
public int deleteStoriesOlderThan(long timestamp, boolean hasSeenReleaseChannelStories) {
|
||||||
|
@ -1940,6 +1939,8 @@ public class MessageTable extends DatabaseTable implements MessageTypes, Recipie
|
||||||
db.endTransaction();
|
db.endTransaction();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
OptimizeMessageSearchIndexJob.enqueue();
|
||||||
|
|
||||||
ApplicationDependencies.getDatabaseObserver().notifyMessageUpdateObservers(new MessageId(messageId));
|
ApplicationDependencies.getDatabaseObserver().notifyMessageUpdateObservers(new MessageId(messageId));
|
||||||
ApplicationDependencies.getDatabaseObserver().notifyConversationListListeners();
|
ApplicationDependencies.getDatabaseObserver().notifyConversationListListeners();
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,12 @@
|
||||||
package org.thoughtcrime.securesms.jobs
|
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.Data
|
||||||
import org.thoughtcrime.securesms.jobmanager.Job
|
import org.thoughtcrime.securesms.jobmanager.Job
|
||||||
import org.thoughtcrime.securesms.transport.RetryLaterException
|
import org.thoughtcrime.securesms.transport.RetryLaterException
|
||||||
import java.lang.Exception
|
import java.lang.Exception
|
||||||
import kotlin.time.Duration.Companion.minutes
|
import kotlin.time.Duration.Companion.seconds
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Optimizes the message search index incrementally.
|
* Optimizes the message search index incrementally.
|
||||||
|
@ -16,8 +18,7 @@ class OptimizeMessageSearchIndexJob private constructor(parameters: Parameters)
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun enqueue() {
|
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 getFactoryKey() = KEY
|
||||||
override fun onFailure() = Unit
|
override fun onFailure() = Unit
|
||||||
override fun onShouldRetry(e: Exception) = e is RetryLaterException
|
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() {
|
override fun onRun() {
|
||||||
// TODO [greyson] Temporarily disabled until we can figure out what to do.
|
val success = SignalDatabase.messageSearch.optimizeIndex(5.seconds.inWholeMilliseconds)
|
||||||
// val success = SignalDatabase.messageSearch.optimizeIndex(10.seconds.inWholeMilliseconds)
|
|
||||||
//
|
if (!success) {
|
||||||
// if (!success) {
|
throw RetryLaterException()
|
||||||
// throw RetryLaterException()
|
}
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class Factory : Job.Factory<OptimizeMessageSearchIndexJob> {
|
class Factory : Job.Factory<OptimizeMessageSearchIndexJob> {
|
||||||
|
|
Ładowanie…
Reference in New Issue