mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-23 10:20:25 +01:00
Fix flakiness of the backup tests.
It's possible that pending writes to the key value store (from using .apply()) may not be finished by the time we take the DB snapshot, resulting in us seeing stale data in the snapshot. Now we block on writes finishing.
This commit is contained in:
@@ -165,6 +165,8 @@ object BackupRepository {
|
||||
private fun createSignalStoreSnapshot(baseName: String): SignalStore {
|
||||
val context = AppDependencies.application
|
||||
|
||||
SignalStore.blockUntilAllWritesFinished()
|
||||
|
||||
// Need to do a WAL checkpoint to ensure that the database file we're copying has all pending writes
|
||||
if (!KeyValueDatabase.getInstance(context).writableDatabase.fullWalCheckpoint()) {
|
||||
Log.w(TAG, "Failed to checkpoint WAL for KeyValueDatabase! Not guaranteed to be using the most recent data.")
|
||||
|
||||
@@ -41,6 +41,8 @@ object RecipientBackupProcessor {
|
||||
)
|
||||
)
|
||||
)
|
||||
} else {
|
||||
Log.w(TAG, "Missing release channel id on export!")
|
||||
}
|
||||
|
||||
db.recipientTable.getContactsForBackup(selfId).use { reader ->
|
||||
|
||||
Reference in New Issue
Block a user