Log the end of the migration and it's duration

This commit is contained in:
Benoit Marty 2022-07-13 13:55:22 +02:00 committed by Benoit Marty
parent 069c0c7cb4
commit ae8f977d6b
1 changed files with 5 additions and 1 deletions

View File

@ -19,6 +19,7 @@ package org.matrix.android.sdk.internal.util.database
import io.realm.DynamicRealm import io.realm.DynamicRealm
import io.realm.RealmObjectSchema import io.realm.RealmObjectSchema
import timber.log.Timber import timber.log.Timber
import kotlin.system.measureTimeMillis
internal abstract class RealmMigrator( internal abstract class RealmMigrator(
private val realm: DynamicRealm, private val realm: DynamicRealm,
@ -26,7 +27,10 @@ internal abstract class RealmMigrator(
) { ) {
fun perform() { fun perform() {
Timber.d("Migrate ${realm.configuration.realmFileName} to $targetSchemaVersion") Timber.d("Migrate ${realm.configuration.realmFileName} to $targetSchemaVersion")
doMigrate(realm) val duration = measureTimeMillis {
doMigrate(realm)
}
Timber.d("Migrate ${realm.configuration.realmFileName} to $targetSchemaVersion took $duration ms.")
} }
abstract fun doMigrate(realm: DynamicRealm) abstract fun doMigrate(realm: DynamicRealm)