Skip to content

Commit

Permalink
Fix retries: don't upload metadata three times
Browse files Browse the repository at this point in the history
  • Loading branch information
grote committed Sep 5, 2024
1 parent 5418a8e commit 17d0885
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ internal class ApkBackupManager(
for (i in 1..n) {
try {
block()
return
} catch (e: Exception) {
if (i == n) throw e
Log.e(TAG, "Error (#$i), we'll keep trying", e)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,10 @@ internal class ApkBackupManagerTest : TransportTest() {
apkBackup.backupApkIfNecessary(notAllowedPackages[1], any())
metadataOutputStream.close()
}
// metadata should only get uploaded once
verify(exactly = 1) {
metadataManager.uploadMetadata(metadataOutputStream)
}
}

@Test
Expand Down

0 comments on commit 17d0885

Please sign in to comment.