mirror of
https://github.com/M66B/FairEmail.git
synced 2024-12-28 18:59:01 +00:00
Simplification
This commit is contained in:
parent
bc917dedb5
commit
59d85f25bd
1 changed files with 4 additions and 8 deletions
|
@ -33,7 +33,6 @@ import androidx.work.Worker;
|
||||||
import androidx.work.WorkerParameters;
|
import androidx.work.WorkerParameters;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileNotFoundException;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
@ -66,11 +65,13 @@ public class WorkerFts extends Worker {
|
||||||
SQLiteDatabase sdb = FtsDbHelper.getInstance(context);
|
SQLiteDatabase sdb = FtsDbHelper.getInstance(context);
|
||||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||||
try (Cursor cursor = db.message().getMessageFts()) {
|
try (Cursor cursor = db.message().getMessageFts()) {
|
||||||
while (cursor.moveToNext()) {
|
while (cursor.moveToNext())
|
||||||
long id = cursor.getLong(0);
|
|
||||||
try {
|
try {
|
||||||
|
long id = cursor.getLong(0);
|
||||||
Log.i("FTS index=" + id);
|
Log.i("FTS index=" + id);
|
||||||
|
|
||||||
|
ids.add(id);
|
||||||
|
|
||||||
EntityMessage message = db.message().getMessage(id);
|
EntityMessage message = db.message().getMessage(id);
|
||||||
if (message == null) {
|
if (message == null) {
|
||||||
Log.i("FTS gone");
|
Log.i("FTS gone");
|
||||||
|
@ -98,16 +99,11 @@ public class WorkerFts extends Worker {
|
||||||
|
|
||||||
indexed++;
|
indexed++;
|
||||||
|
|
||||||
ids.add(id);
|
|
||||||
if (ids.size() > INDEX_BATCH_SIZE)
|
if (ids.size() > INDEX_BATCH_SIZE)
|
||||||
markIndexed(db, ids);
|
markIndexed(db, ids);
|
||||||
} catch (Throwable ex) {
|
} catch (Throwable ex) {
|
||||||
if (ex instanceof FileNotFoundException ||
|
|
||||||
ex instanceof OutOfMemoryError)
|
|
||||||
ids.add(id);
|
|
||||||
Log.e(ex);
|
Log.e(ex);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
markIndexed(db, ids);
|
markIndexed(db, ids);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue