From 42f360758064309b2f346736cd0205222d64c8a0 Mon Sep 17 00:00:00 2001 From: Snd-R <76580768+snd-r@users.noreply.github.com> Date: Sun, 8 Sep 2024 08:16:06 +0300 Subject: [PATCH] fix mangadex cover pagination --- .../snd/komf/providers/mangadex/MangaDexMetadataProvider.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/komf-core/src/commonMain/kotlin/snd/komf/providers/mangadex/MangaDexMetadataProvider.kt b/komf-core/src/commonMain/kotlin/snd/komf/providers/mangadex/MangaDexMetadataProvider.kt index 79a64044..7a68a925 100644 --- a/komf-core/src/commonMain/kotlin/snd/komf/providers/mangadex/MangaDexMetadataProvider.kt +++ b/komf-core/src/commonMain/kotlin/snd/komf/providers/mangadex/MangaDexMetadataProvider.kt @@ -69,11 +69,13 @@ class MangaDexMetadataProvider( private suspend fun getAllCovers(mangaId: MangaDexMangaId): List { val covers = mutableListOf() var offset = 0 - while (true) { - val page = client.getSeriesCovers(mangaId, 100, 0) + var requestCount = 0 + while (requestCount < 100) { + val page = client.getSeriesCovers(mangaId, 100, offset) covers.addAll(page.data) if (page.offset + page.limit > page.total) break offset += page.limit + requestCount++ } return covers }