mirror of
https://github.com/mihonapp/mihon.git
synced 2026-10-16 13:48:09 -07:00
Count early, late and backdated releases when predicting next update
This commit is contained in:
@@ -226,11 +226,18 @@ class SyncChaptersWithSource(
|
||||
updated = updatedChapters,
|
||||
)
|
||||
|
||||
val excludedScanlators = getExcludedScanlators.await(manga.id).toHashSet()
|
||||
|
||||
// A first fetch lists the back catalogue, and chapters coming back under a deleted number were out already
|
||||
val foundRelease = dbChapters.isNotEmpty() &&
|
||||
toAdd.any { chapter ->
|
||||
chapter.scanlator !in excludedScanlators &&
|
||||
!(chapter.isRecognizedNumber && chapter.chapterNumber in deletedChapterNumbers)
|
||||
}
|
||||
|
||||
// Set this manga as updated since chapters were changed
|
||||
// Note that last_update actually represents last time the chapter list changed at all
|
||||
updateManga.awaitUpdateFetchIntervalAndLastUpdate(manga, timeZone, now, fetchWindow)
|
||||
|
||||
val excludedScanlators = getExcludedScanlators.await(manga.id).toHashSet()
|
||||
updateManga.awaitUpdateFetchIntervalAndLastUpdate(manga, timeZone, now, fetchWindow, foundRelease)
|
||||
|
||||
return added.filterNot { it.url in changedOrDuplicateReadUrls || it.scanlator in excludedScanlators }
|
||||
}
|
||||
|
||||
@@ -44,9 +44,10 @@ class UpdateManga(
|
||||
timeZone: TimeZone,
|
||||
dateTime: LocalDateTime,
|
||||
window: ClosedRange<Instant>?,
|
||||
foundRelease: Boolean,
|
||||
): Boolean {
|
||||
return mangaRepository.update(
|
||||
fetchInterval.withFetchInterval(manga, dateTime, timeZone, window).apply {
|
||||
fetchInterval.withFetchInterval(manga, dateTime, timeZone, window, foundRelease).apply {
|
||||
lastUpdate = Clock.System.now()
|
||||
},
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user