mirror of https://github.com/M66B/FairEmail.git
Run database actions low priority
Why isn't this the default mr Google?
This commit is contained in:
parent
7119f537ce
commit
e8f18afd28
|
@ -12,6 +12,8 @@ import org.json.JSONObject;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.concurrent.ExecutorService;
|
||||||
|
import java.util.concurrent.Executors;
|
||||||
|
|
||||||
import javax.mail.Address;
|
import javax.mail.Address;
|
||||||
import javax.mail.internet.InternetAddress;
|
import javax.mail.internet.InternetAddress;
|
||||||
|
@ -79,6 +81,7 @@ public abstract class DB extends RoomDatabase {
|
||||||
public abstract DaoLog log();
|
public abstract DaoLog log();
|
||||||
|
|
||||||
private static DB sInstance;
|
private static DB sInstance;
|
||||||
|
private static ExecutorService executor = Executors.newCachedThreadPool(Helper.backgroundThreadFactory);
|
||||||
|
|
||||||
private static final String DB_NAME = "fairemail";
|
private static final String DB_NAME = "fairemail";
|
||||||
|
|
||||||
|
@ -87,6 +90,7 @@ public abstract class DB extends RoomDatabase {
|
||||||
sInstance = migrate(context, Room
|
sInstance = migrate(context, Room
|
||||||
.databaseBuilder(context.getApplicationContext(), DB.class, DB_NAME)
|
.databaseBuilder(context.getApplicationContext(), DB.class, DB_NAME)
|
||||||
.openHelperFactory(new RequerySQLiteOpenHelperFactory())
|
.openHelperFactory(new RequerySQLiteOpenHelperFactory())
|
||||||
|
.setQueryExecutor(executor)
|
||||||
.setJournalMode(JournalMode.WRITE_AHEAD_LOGGING));
|
.setJournalMode(JournalMode.WRITE_AHEAD_LOGGING));
|
||||||
|
|
||||||
Log.i("sqlite version=" + exec(sInstance, "SELECT sqlite_version() AS sqlite_version"));
|
Log.i("sqlite version=" + exec(sInstance, "SELECT sqlite_version() AS sqlite_version"));
|
||||||
|
|
Loading…
Reference in New Issue