Skip to content

Commit

Permalink
Fix UI freeze after migration
Browse files Browse the repository at this point in the history
Fixes #938
  • Loading branch information
AntsyLich committed Aug 11, 2024
1 parent 84b2164 commit 3f1d28c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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),
)
}
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/mihon/core/migration/Migrator.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,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,
Expand Down

0 comments on commit 3f1d28c

Please sign in to comment.