Ensure main database is updated before opening secondary ones.
This commit is contained in:
parent
2220ceb9d9
commit
e0e3f7dfec
5 changed files with 5 additions and 0 deletions
|
@ -94,6 +94,7 @@ public class JobDatabase extends SQLiteOpenHelper implements SignalDatabaseOpenH
|
|||
synchronized (JobDatabase.class) {
|
||||
if (instance == null) {
|
||||
SqlCipherLibraryLoader.load();
|
||||
SignalDatabase.triggerDatabaseAccess(); // Ensures that our main database is up-to-date before this one is accessed
|
||||
instance = new JobDatabase(context, DatabaseSecretProvider.getOrCreateDatabaseSecret(context));
|
||||
instance.setWriteAheadLoggingEnabled(true);
|
||||
}
|
||||
|
|
|
@ -54,6 +54,7 @@ public class KeyValueDatabase extends SQLiteOpenHelper implements SignalDatabase
|
|||
synchronized (KeyValueDatabase.class) {
|
||||
if (instance == null) {
|
||||
SqlCipherLibraryLoader.load();
|
||||
SignalDatabase.triggerDatabaseAccess(); // Ensures that our main database is up-to-date before this one is accessed
|
||||
instance = new KeyValueDatabase(context, DatabaseSecretProvider.getOrCreateDatabaseSecret(context));
|
||||
instance.setWriteAheadLoggingEnabled(true);
|
||||
}
|
||||
|
|
|
@ -82,6 +82,7 @@ class LocalMetricsDatabase private constructor(
|
|||
synchronized(LocalMetricsDatabase::class.java) {
|
||||
if (instance == null) {
|
||||
SqlCipherLibraryLoader.load()
|
||||
SignalDatabase.triggerDatabaseAccess() // Ensures that our main database is up-to-date before this one is accessed
|
||||
instance = LocalMetricsDatabase(context, DatabaseSecretProvider.getOrCreateDatabaseSecret(context))
|
||||
instance!!.setWriteAheadLoggingEnabled(true)
|
||||
}
|
||||
|
|
|
@ -86,6 +86,7 @@ class LogDatabase private constructor(
|
|||
synchronized(LogDatabase::class.java) {
|
||||
if (instance == null) {
|
||||
SqlCipherLibraryLoader.load()
|
||||
SignalDatabase.triggerDatabaseAccess() // Ensures that our main database is up-to-date before this one is accessed
|
||||
instance = LogDatabase(context, DatabaseSecretProvider.getOrCreateDatabaseSecret(context))
|
||||
instance!!.setWriteAheadLoggingEnabled(true)
|
||||
}
|
||||
|
|
|
@ -57,6 +57,7 @@ public class MegaphoneDatabase extends SQLiteOpenHelper implements SignalDatabas
|
|||
synchronized (MegaphoneDatabase.class) {
|
||||
if (instance == null) {
|
||||
SqlCipherLibraryLoader.load();
|
||||
SignalDatabase.triggerDatabaseAccess(); // Ensures that our main database is up-to-date before this one is accessed
|
||||
instance = new MegaphoneDatabase(context, DatabaseSecretProvider.getOrCreateDatabaseSecret(context));
|
||||
instance.setWriteAheadLoggingEnabled(true);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue