Fix Migrator not doing work (#604)

This commit is contained in:
Andreas 2024-03-31 00:03:28 +01:00 committed by GitHub
parent 7c6fd026a3
commit 6b3423a12b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -2,6 +2,7 @@ package mihon.core.migration
import kotlinx.coroutines.CompletableDeferred import kotlinx.coroutines.CompletableDeferred
import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.CoroutineStart
import kotlinx.coroutines.Deferred import kotlinx.coroutines.Deferred
import kotlinx.coroutines.async import kotlinx.coroutines.async
import tachiyomi.core.common.util.system.logcat import tachiyomi.core.common.util.system.logcat
@ -17,7 +18,7 @@ class MigrationJobFactory(
.fold(CompletableDeferred(true)) { acc: Deferred<Boolean>, migration: Migration -> .fold(CompletableDeferred(true)) { acc: Deferred<Boolean>, migration: Migration ->
if (!migrationContext.dryrun) { if (!migrationContext.dryrun) {
logcat { "Running migration: { name = ${migration::class.simpleName}, version = ${migration.version} }" } logcat { "Running migration: { name = ${migration::class.simpleName}, version = ${migration.version} }" }
async { async(start = CoroutineStart.UNDISPATCHED) {
val prev = acc.await() val prev = acc.await()
migration(migrationContext) || prev migration(migrationContext) || prev
} }