mirror of
https://github.com/M66B/FairEmail.git
synced 2026-01-03 03:19:24 +01:00
Use dedicated transaction executor
This commit is contained in:
@@ -357,12 +357,14 @@ public abstract class DB extends RoomDatabase {
|
||||
int threads = prefs.getInt("query_threads", 4); // AndroidX default thread count: 4
|
||||
boolean wal = prefs.getBoolean("wal", true);
|
||||
Log.i("DB query threads=" + threads + " wal=" + wal);
|
||||
ExecutorService executor = Helper.getBackgroundExecutor(threads, "query");
|
||||
ExecutorService executorQuery = Helper.getBackgroundExecutor(threads, "query");
|
||||
ExecutorService executorTransaction = Helper.getBackgroundExecutor(0, "transaction");
|
||||
|
||||
return Room
|
||||
.databaseBuilder(context, DB.class, DB_NAME)
|
||||
.openHelperFactory(new RequerySQLiteOpenHelperFactory())
|
||||
.setQueryExecutor(executor)
|
||||
.setQueryExecutor(executorQuery)
|
||||
.setTransactionExecutor(executorTransaction)
|
||||
.setJournalMode(wal ? JournalMode.WRITE_AHEAD_LOGGING : JournalMode.TRUNCATE) // using the latest sqlite
|
||||
.addCallback(new Callback() {
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user