Use transaction on restore to go brr. (#10375)

refactor: use transaction to go brr.

This improve the restore speed on fresh db and non fresh db.

Signed-off-by: KaiserBh <kaiserbh@proton.me>
(cherry picked from commit b1067b942ef5c8d53e5ab838ef078789b9c0627a)

# Conflicts:
#	app/src/main/java/eu/kanade/tachiyomi/data/backup/restore/restorers/MangaRestorer.kt
This commit is contained in:
KaiserBh 2024-01-12 10:22:46 +11:00 committed by Jobobby04
parent f24d50af44
commit f6407805d3

View File

@ -71,6 +71,7 @@ class MangaRestorer(
backupManga: BackupManga,
backupCategories: List<BackupCategory>,
) {
handler.await(inTransaction = true) {
val dbManga = findExistingManga(backupManga)
var manga = backupManga.getMangaImpl()
// SY -->
@ -96,6 +97,7 @@ class MangaRestorer(
// SY <--
)
}
}
private suspend fun findExistingManga(backupManga: BackupManga): Manga? {
return getMangaByUrlAndSourceId.await(backupManga.url, backupManga.source)