From 4e147d440e3a5295f487bd5d2e6095fb3732906c Mon Sep 17 00:00:00 2001 From: M66B Date: Wed, 9 Mar 2022 21:11:46 +0100 Subject: [PATCH] Allow sqlite checkpoints --- app/src/main/java/eu/faircode/email/DB.java | 3 --- .../main/java/eu/faircode/email/FragmentOptionsMisc.java | 6 +++--- app/src/main/java/eu/faircode/email/WorkerFts.java | 2 +- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/DB.java b/app/src/main/java/eu/faircode/email/DB.java index 202f82bede..69d85ad9b7 100644 --- a/app/src/main/java/eu/faircode/email/DB.java +++ b/app/src/main/java/eu/faircode/email/DB.java @@ -2299,9 +2299,6 @@ public abstract class DB extends RoomDatabase { } public static void checkpoint(Context context) { - if (!BuildConfig.DEBUG) - return; - // https://www.sqlite.org/pragma.html#pragma_wal_checkpoint DB db = getInstance(context); db.getQueryExecutor().execute(new Runnable() { diff --git a/app/src/main/java/eu/faircode/email/FragmentOptionsMisc.java b/app/src/main/java/eu/faircode/email/FragmentOptionsMisc.java index 5bfec45740..ac89e373ae 100644 --- a/app/src/main/java/eu/faircode/email/FragmentOptionsMisc.java +++ b/app/src/main/java/eu/faircode/email/FragmentOptionsMisc.java @@ -197,7 +197,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc "experiments", "crash_reports", "cleanup_attachments", "protocol", "debug", "log_level", "test1", "test2", "test3", "test4", "test5", "work_manager", // "external_storage", - "query_threads", "wal", "checkpoints", "sqlite_analyze", "sqlite_cache", + "query_threads", "wal", "sqlite_checkpoints", "sqlite_analyze", "sqlite_cache", "chunk_size", "undo_manager", "webview_legacy", "use_modseq", "uid_command", "perform_expunge", "uid_expunge", "auth_plain", "auth_login", "auth_ntlm", "auth_sasl", "auth_apop", @@ -881,7 +881,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc swCheckpoints.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { - prefs.edit().putBoolean("checkpoints", checked).apply(); + prefs.edit().putBoolean("sqlite_checkpoints", checked).apply(); } }); @@ -1602,7 +1602,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc sbRoomQueryThreads.setProgress(query_threads); swWal.setChecked(prefs.getBoolean("wal", true)); - swCheckpoints.setChecked(prefs.getBoolean("checkpoints", true)); + swCheckpoints.setChecked(prefs.getBoolean("sqlite_checkpoints", false)); swAnalyze.setChecked(prefs.getBoolean("sqlite_analyze", true)); int sqlite_cache = prefs.getInt("sqlite_cache", DB.DEFAULT_CACHE_SIZE); diff --git a/app/src/main/java/eu/faircode/email/WorkerFts.java b/app/src/main/java/eu/faircode/email/WorkerFts.java index 6e1d96cb90..6c424d43e1 100644 --- a/app/src/main/java/eu/faircode/email/WorkerFts.java +++ b/app/src/main/java/eu/faircode/email/WorkerFts.java @@ -59,7 +59,7 @@ public class WorkerFts extends Worker { Context context = getApplicationContext(); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); - boolean checkpoints = prefs.getBoolean("checkpoints", true); + boolean checkpoints = prefs.getBoolean("sqlite_checkpoints", false); int indexed = 0; List ids = new ArrayList<>(INDEX_BATCH_SIZE);