Skip to content

Commit d34c4c1

Browse files
Rotate uploadEra when disabling Backups
1 parent 058ec30 commit d34c4c1

File tree

4 files changed

+11
-1
lines changed

4 files changed

+11
-1
lines changed

SignalServiceKit/Backups/Settings/BackupDisablingManager.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ public final class BackupDisablingManager {
2121
private let authCredentialStore: AuthCredentialStore
2222
private let backupAttachmentCoordinator: BackupAttachmentCoordinator
2323
private let backupAttachmentDownloadQueueStatusManager: BackupAttachmentDownloadQueueStatusManager
24+
private let backupAttachmentUploadEraStore: BackupAttachmentUploadEraStore
2425
private let backupCDNCredentialStore: BackupCDNCredentialStore
2526
private let backupKeyService: BackupKeyService
2627
private let backupPlanManager: BackupPlanManager
@@ -36,6 +37,7 @@ public final class BackupDisablingManager {
3637
authCredentialStore: AuthCredentialStore,
3738
backupAttachmentCoordinator: BackupAttachmentCoordinator,
3839
backupAttachmentDownloadQueueStatusManager: BackupAttachmentDownloadQueueStatusManager,
40+
backupAttachmentUploadEraStore: BackupAttachmentUploadEraStore,
3941
backupCDNCredentialStore: BackupCDNCredentialStore,
4042
backupKeyService: BackupKeyService,
4143
backupPlanManager: BackupPlanManager,
@@ -47,6 +49,7 @@ public final class BackupDisablingManager {
4749
self.authCredentialStore = authCredentialStore
4850
self.backupAttachmentCoordinator = backupAttachmentCoordinator
4951
self.backupAttachmentDownloadQueueStatusManager = backupAttachmentDownloadQueueStatusManager
52+
self.backupAttachmentUploadEraStore = backupAttachmentUploadEraStore
5053
self.backupCDNCredentialStore = backupCDNCredentialStore
5154
self.backupKeyService = backupKeyService
5255
self.backupPlanManager = backupPlanManager
@@ -222,6 +225,10 @@ public final class BackupDisablingManager {
222225
authCredentialStore.removeAllBackupAuthCredentials(tx: tx)
223226
backupCDNCredentialStore.wipe(tx: tx)
224227

228+
// If we reenable, we need to run another list-media to discover
229+
// that we need to reupload all our media.
230+
backupAttachmentUploadEraStore.rotateUploadEra(tx: tx)
231+
225232
if let aepBeingRotatedString = kvStore.getString(StoreKeys.aepBeingRotated, transaction: tx) {
226233
logger.warn("Rotating AEP after disabling Backups!")
227234

SignalServiceKit/Environment/AppSetup.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1064,6 +1064,7 @@ extension AppSetup.GlobalsContinuation {
10641064
authCredentialStore: authCredentialStore,
10651065
backupAttachmentCoordinator: backupAttachmentCoordinator,
10661066
backupAttachmentDownloadQueueStatusManager: backupAttachmentDownloadQueueStatusManager,
1067+
backupAttachmentUploadEraStore: backupAttachmentUploadEraStore,
10671068
backupCDNCredentialStore: backupCDNCredentialStore,
10681069
backupKeyService: backupKeyService,
10691070
backupPlanManager: backupPlanManager,

SignalServiceKit/Environment/RemoteConfigManager.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ public class RemoteConfig {
238238
if BuildFlags.Backups.useLowerDefaultListMediaRefreshInterval {
239239
defaultValue = .dayInMs
240240
} else {
241-
defaultValue = .dayInMs * 30
241+
defaultValue = .dayInMs * 7
242242
}
243243
return getUInt64Value(forFlag: .backupListMediaDefaultRefreshIntervalMs, defaultValue: defaultValue)
244244
}

SignalServiceKit/tests/MessageBackup/BackupDisablingManagerTest.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ struct BackupDisablingManagerTest {
1414
let mockAccountEntropyPoolManager = MockAccountEntropyPoolManager()
1515
let mockAuthCredentialStore = AuthCredentialStore(dateProvider: { Date() })
1616
let mockBackupAttachmentDownloadQueueStatusManager = MockBackupAttachmentDownloadQueueStatusManager()
17+
let mockBackupAttachmentUploadEraStore = BackupAttachmentUploadEraStore()
1718
let mockBackupCDNCredentialStore = BackupCDNCredentialStore()
1819
let mockBackupKeyService = MockBackupKeyService()
1920
let mockBackupAttachmentCoordinator = MockBackupAttachmentCoordinator()
@@ -27,6 +28,7 @@ struct BackupDisablingManagerTest {
2728
authCredentialStore: mockAuthCredentialStore,
2829
backupAttachmentCoordinator: mockBackupAttachmentCoordinator,
2930
backupAttachmentDownloadQueueStatusManager: mockBackupAttachmentDownloadQueueStatusManager,
31+
backupAttachmentUploadEraStore: mockBackupAttachmentUploadEraStore,
3032
backupCDNCredentialStore: mockBackupCDNCredentialStore,
3133
backupKeyService: mockBackupKeyService,
3234
backupPlanManager: mockBackupPlanManager,

0 commit comments

Comments
 (0)