fix: Fix UI freeze after migration

This commit is contained in:
AntsyLich 2024-08-12 03:21:17 +06:00 committed by Ahmad Ansori Palembani
parent 9403a9c64c
commit 5ac816225f
Signed by: null2264
GPG key ID: BA64F8B60AF3EFB6
2 changed files with 2 additions and 4 deletions

View file

@ -6,15 +6,13 @@ class MigrationStrategyFactory(
) {
fun create(old: Int, new: Int): MigrationStrategy {
val versions = (old + 1)..new
val strategy = when {
old == 0 -> InitialMigrationStrategy(
strategy = DefaultMigrationStrategy(factory, migrationCompletedListener, Migrator.scope),
)
old >= new -> NoopMigrationStrategy(false)
else -> VersionRangeMigrationStrategy(
versions = versions,
versions = (old + 1)..new,
strategy = DefaultMigrationStrategy(factory, migrationCompletedListener, Migrator.scope),
)
}

View file

@ -9,7 +9,7 @@ import kotlinx.coroutines.runBlocking
object Migrator {
private var result: Deferred<Boolean>? = null
val scope = CoroutineScope(Dispatchers.Main + Job())
val scope = CoroutineScope(Dispatchers.IO + Job())
fun initialize(
old: Int,