1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2024-12-28 02:37:16 +00:00

Simplification

This commit is contained in:
M66B 2020-12-30 08:28:54 +01:00
parent bc917dedb5
commit 59d85f25bd

View file

@ -33,7 +33,6 @@ import androidx.work.Worker;
import androidx.work.WorkerParameters;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.TimeUnit;
@ -66,11 +65,13 @@ public class WorkerFts extends Worker {
SQLiteDatabase sdb = FtsDbHelper.getInstance(context);
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
try (Cursor cursor = db.message().getMessageFts()) {
while (cursor.moveToNext()) {
long id = cursor.getLong(0);
while (cursor.moveToNext())
try {
long id = cursor.getLong(0);
Log.i("FTS index=" + id);
ids.add(id);
EntityMessage message = db.message().getMessage(id);
if (message == null) {
Log.i("FTS gone");
@ -98,16 +99,11 @@ public class WorkerFts extends Worker {
indexed++;
ids.add(id);
if (ids.size() > INDEX_BATCH_SIZE)
markIndexed(db, ids);
} catch (Throwable ex) {
if (ex instanceof FileNotFoundException ||
ex instanceof OutOfMemoryError)
ids.add(id);
Log.e(ex);
}
}
markIndexed(db, ids);
}