Merge pull request #736 from grote/fix-retry
Fix retries: don't upload metadata three times
This commit is contained in:
commit
b8602fdcc2
2 changed files with 5 additions and 0 deletions
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue