From e0b378e2bee90a8bf00cf9665aa36580b7da32c5 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Mon, 27 Jun 2022 17:30:26 +0200 Subject: [PATCH] Delete all the chunks in one step. --- .../sdk/internal/database/migration/MigrateSessionTo030.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/migration/MigrateSessionTo030.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/migration/MigrateSessionTo030.kt index 83cd63bf47..b9c611f5dd 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/migration/MigrateSessionTo030.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/migration/MigrateSessionTo030.kt @@ -35,6 +35,7 @@ internal class MigrateSessionTo030(realm: DynamicRealm) : RealmMigrator(realm, 3 .equalTo(ChunkEntityFields.IS_LAST_FORWARD, false) .findAll() + val nbOfDeletedChunks = chunks.size var nbOfDeletedTimelineEvents = 0 var nbOfDeletedEvents = 0 chunks.forEach { chunk -> @@ -49,8 +50,8 @@ internal class MigrateSessionTo030(realm: DynamicRealm) : RealmMigrator(realm, 3 } nbOfDeletedTimelineEvents += timelineEvents.size timelineEvents.deleteAllFromRealm() - chunk.deleteFromRealm() } - Timber.d("MigrateSessionTo030: $nbOfDeletedTimelineEvents deleted TimelineEvent(s) and $nbOfDeletedEvents deleted Event(s).") + chunks.deleteAllFromRealm() + Timber.d("MigrateSessionTo030: $nbOfDeletedChunks deleted chunk(s), $nbOfDeletedTimelineEvents deleted TimelineEvent(s) and $nbOfDeletedEvents deleted Event(s).") } }