From 061e6a4c17c9c07125995b04bb67c03b11b1c0ca Mon Sep 17 00:00:00 2001 From: Shamicen Date: Sun, 3 Mar 2024 13:27:56 +0100 Subject: [PATCH] performance improvements --- .../androidMain/kotlin/tachiyomi/source/local/LocalSource.kt | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/source-local/src/androidMain/kotlin/tachiyomi/source/local/LocalSource.kt b/source-local/src/androidMain/kotlin/tachiyomi/source/local/LocalSource.kt index e7b7ed023..ce3624486 100644 --- a/source-local/src/androidMain/kotlin/tachiyomi/source/local/LocalSource.kt +++ b/source-local/src/androidMain/kotlin/tachiyomi/source/local/LocalSource.kt @@ -134,15 +134,14 @@ actual class LocalSource( private fun loadMangaForPage(page: Int) { if (page != loadedPages + 1 || page == currentlyLoadingPage) return - currentlyLoadingPage = loadedPages + 1 + val localMangaList = runBlocking { getMangaList() } val mangaPage = mangaDirChunks[page - 1].map { mangaDir -> SManga.create().apply manga@{ url = mangaDir.name.toString() dirLastModifiedAt = mangaDir.lastModified() - val localMangaList = runBlocking { getMangaList() } mangaDir.name?.let { title = localMangaList[url]?.title ?: it } author = localMangaList[url]?.author artist = localMangaList[url]?.artist @@ -162,7 +161,7 @@ actual class LocalSource( val chapter = chapters.last() // only read metadata from disk if it the mangaDir has been modified - if (dirLastModifiedAt != localMangaList[url]?.lastModifiedAt) { + if (dirLastModifiedAt != localMangaList[url]?.dirLastModifiedAt) { when (val format = getFormat(chapter)) { is Format.Directory -> getMangaDetails(this@manga) is Format.Zip -> getMangaDetails(this@manga)