diff --git a/app/src/main/java/com/stevesoltys/seedvault/worker/ApkBackupManager.kt b/app/src/main/java/com/stevesoltys/seedvault/worker/ApkBackupManager.kt index a36eafe7..0e5d48d6 100644 --- a/app/src/main/java/com/stevesoltys/seedvault/worker/ApkBackupManager.kt +++ b/app/src/main/java/com/stevesoltys/seedvault/worker/ApkBackupManager.kt @@ -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) diff --git a/app/src/test/java/com/stevesoltys/seedvault/worker/ApkBackupManagerTest.kt b/app/src/test/java/com/stevesoltys/seedvault/worker/ApkBackupManagerTest.kt index 5a7652eb..5dafa04b 100644 --- a/app/src/test/java/com/stevesoltys/seedvault/worker/ApkBackupManagerTest.kt +++ b/app/src/test/java/com/stevesoltys/seedvault/worker/ApkBackupManagerTest.kt @@ -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