From 4324373e6173223746c27b8ef8670c12cf485916 Mon Sep 17 00:00:00 2001 From: schroda <50052685+schroda@users.noreply.github.com> Date: Thu, 2 Nov 2023 01:24:34 +0100 Subject: [PATCH] Fix/chapter list fetch updating and inserting chapters into database (#749) * Keep initial fetch date of existing chapters on a list fetch The fetch at date should not get updated for existing chapters. Updating this field makes it impossible to detect which chapters were actually newly fetched. To get the last fetched timestamp of the chapters, the "chaptersLastFetchedAt" field of the manga should be used got changed in 6d33d726630c0ef69a0b85006b9e9a394c119026 * Get real chapter url safely In case this causes an exception, it should not cause the whole list fetch to fail was removed in 6d33d726630c0ef69a0b85006b9e9a394c119026 --- .../src/main/kotlin/suwayomi/tachidesk/manga/impl/Chapter.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/server/src/main/kotlin/suwayomi/tachidesk/manga/impl/Chapter.kt b/server/src/main/kotlin/suwayomi/tachidesk/manga/impl/Chapter.kt index 8a19d843..4f13e719 100644 --- a/server/src/main/kotlin/suwayomi/tachidesk/manga/impl/Chapter.kt +++ b/server/src/main/kotlin/suwayomi/tachidesk/manga/impl/Chapter.kt @@ -150,7 +150,9 @@ object Chapter { index + 1, now, mangaId, - (source as? HttpSource)?.getChapterUrl(fetchedChapter), + runCatching { + (source as? HttpSource)?.getChapterUrl(fetchedChapter) + }.getOrNull(), ) if (chapterEntry == null) { @@ -184,7 +186,6 @@ object Chapter { this[ChapterTable.chapter_number] = it.chapterNumber this[ChapterTable.scanlator] = it.scanlator this[ChapterTable.sourceOrder] = it.index - this[ChapterTable.fetchedAt] = it.fetchedAt this[ChapterTable.realUrl] = it.realUrl } execute(this@transaction)