mirror of
https://github.com/mihonapp/mihon.git
synced 2025-11-15 13:37:29 +01:00
Fix freezing on migrating manga (#7317)
* Use `supend` instead of `runBlocking` in migrate function * lift `syncChaptersWithSource` out of the db trasaction
This commit is contained in:
@@ -85,7 +85,7 @@ class SearchPresenter(
|
||||
}
|
||||
}
|
||||
|
||||
private fun migrateMangaInternal(
|
||||
private suspend fun migrateMangaInternal(
|
||||
prevSource: Source?,
|
||||
source: Source,
|
||||
sourceChapters: List<SChapter>,
|
||||
@@ -111,15 +111,15 @@ class SearchPresenter(
|
||||
flags,
|
||||
)
|
||||
|
||||
try {
|
||||
syncChaptersWithSource(sourceChapters, manga, source)
|
||||
} catch (e: Exception) {
|
||||
// Worst case, chapters won't be synced
|
||||
}
|
||||
|
||||
db.inTransaction {
|
||||
// Update chapters read
|
||||
if (migrateChapters) {
|
||||
try {
|
||||
syncChaptersWithSource(sourceChapters, manga, source)
|
||||
} catch (e: Exception) {
|
||||
// Worst case, chapters won't be synced
|
||||
}
|
||||
|
||||
val prevMangaChapters = db.getChapters(prevManga).executeAsBlocking()
|
||||
val maxChapterRead = prevMangaChapters
|
||||
.filter { it.read }
|
||||
|
||||
Reference in New Issue
Block a user