mirror of
https://github.com/M66B/FairEmail.git
synced 2024-12-27 02:07:12 +00:00
Always use write ahead logging
This commit is contained in:
parent
f0c5f6fedd
commit
0d307a06eb
1 changed files with 7 additions and 2 deletions
|
@ -75,12 +75,17 @@ public abstract class DB extends RoomDatabase {
|
||||||
|
|
||||||
public static synchronized DB getInstance(Context context) {
|
public static synchronized DB getInstance(Context context) {
|
||||||
if (sInstance == null)
|
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;
|
return sInstance;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static DB getBlockingInstance(Context context) {
|
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) {
|
private static DB migrate(RoomDatabase.Builder<DB> builder) {
|
||||||
|
|
Loading…
Reference in a new issue