Fix retries: don't upload metadata three times

This commit is contained in:
Torsten Grote 2024-09-05 09:11:52 -03:00
parent 5418a8ef12
commit 17d0885e77
No known key found for this signature in database
GPG key ID: 3E5F77D92CF891FF
2 changed files with 5 additions and 0 deletions

View file

@ -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)

View file

@ -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