1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2024-12-26 09:47:13 +00:00

Always use write ahead logging

This commit is contained in:
M66B 2018-08-24 07:58:04 +00:00
parent f0c5f6fedd
commit 0d307a06eb

View file

@ -75,12 +75,17 @@ public abstract class DB extends RoomDatabase {
public static synchronized DB getInstance(Context context) {
if (sInstance == null)
sInstance = migrate(Room.databaseBuilder(context.getApplicationContext(), DB.class, DB_NAME));
sInstance = migrate(Room
.databaseBuilder(context.getApplicationContext(), DB.class, DB_NAME)
.setJournalMode(JournalMode.WRITE_AHEAD_LOGGING));
return sInstance;
}
public static DB getBlockingInstance(Context context) {
return migrate(Room.databaseBuilder(context.getApplicationContext(), DB.class, DB_NAME).allowMainThreadQueries());
return migrate(Room
.databaseBuilder(context.getApplicationContext(), DB.class, DB_NAME)
.setJournalMode(JournalMode.WRITE_AHEAD_LOGGING)
.allowMainThreadQueries());
}
private static DB migrate(RoomDatabase.Builder<DB> builder) {