Skip to content

Commit 3fdd2f3

Browse files
committed
fix: remove backup statuses from observer to avoid infinite loop
1 parent fbcc17d commit 3fdd2f3

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

app/src/main/java/to/bitkit/repositories/BackupRepo.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,9 +171,10 @@ class BackupRepo @Inject constructor(
171171
}
172172
dataListenerJobs.add(tagMetadataJob)
173173

174-
// METADATA - Observe entire CacheStore
174+
// METADATA - Observe entire CacheStore excluding backup statuses
175175
val cacheMetadataJob = scope.launch {
176176
cacheStore.data
177+
.map { it.copy(backupStatuses = mapOf()) }
177178
.distinctUntilChanged()
178179
.drop(1)
179180
.collect {
@@ -414,7 +415,7 @@ class BackupRepo @Inject constructor(
414415

415416
cacheStore.update { parsed.cache }
416417

417-
Logger.debug("Restored ${parsed.tagMetadata.size} tags and complete cache data", context = TAG)
418+
Logger.debug("Restored caches and ${parsed.tagMetadata.size} tags metadata", context = TAG)
418419
}
419420
performRestore(BackupCategory.BLOCKTANK) { dataBytes ->
420421
val parsed = json.decodeFromString<BlocktankBackupV1>(String(dataBytes))

0 commit comments

Comments
 (0)