Use the same thread for db operations in places where trans are possible

This commit is contained in:
Jobobby04
2021-06-13 19:56:17 -04:00
parent 447ddfd8d5
commit e2324df0cc
3 changed files with 8 additions and 6 deletions
+3 -1
View File
@@ -134,7 +134,9 @@ class GalleryAdder {
}
// Fetch and copy details
val newManga = source.getMangaDetails(manga.toMangaInfo())
val newManga = maybeRunBlocking(protectTrans) {
source.getMangaDetails(manga.toMangaInfo())
}
manga.copyFrom(newManga.toSManga())
manga.initialized = true
@@ -48,9 +48,9 @@ class ApiMangaParser(
}
suspend fun parseToManga(manga: MangaInfo, input: MangaResponse, sourceId: Long): MangaInfo {
val mangaId = db.getManga(manga.key, sourceId).executeOnIO()?.id
val mangaId = db.getManga(manga.key, sourceId).executeAsBlocking()?.id
val metadata = if (mangaId != null) {
val flatMetadata = db.getFlatMetadataForManga(mangaId).executeOnIO()
val flatMetadata = db.getFlatMetadataForManga(mangaId).executeAsBlocking()
flatMetadata?.raise(metaClass) ?: newMetaInstance()
} else newMetaInstance()