mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-16 19:59:17 +01:00
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>
This commit is contained in:
parent
d6c4af89c4
commit
b1067b942e
@ -57,6 +57,7 @@ class MangaRestorer(
|
||||
backupManga: BackupManga,
|
||||
backupCategories: List<BackupCategory>,
|
||||
) {
|
||||
handler.await(inTransaction = true) {
|
||||
val dbManga = findExistingManga(backupManga)
|
||||
val manga = backupManga.getMangaImpl()
|
||||
val restoredManga = if (dbManga == null) {
|
||||
@ -74,6 +75,7 @@ class MangaRestorer(
|
||||
tracks = backupManga.tracking,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
private suspend fun findExistingManga(backupManga: BackupManga): Manga? {
|
||||
return getMangaByUrlAndSourceId.await(backupManga.url, backupManga.source)
|
||||
|
Loading…
Reference in New Issue
Block a user