mirror of
https://github.com/mihonapp/mihon.git
synced 2026-10-19 23:22:26 -07:00
Cancel queued downloads of chapters the source removed (#3845)
Closes #3845 Fixes #3811 Fixes #3501 Co-authored-by: Joseph <50675784+JoJoKorok@users.noreply.github.com>
This commit is contained in:
@@ -142,6 +142,11 @@ class SyncChaptersWithSource(
|
||||
|
||||
val removedChapters = dbChapters.filterNot { it.url in sourceUrls }
|
||||
|
||||
// The source no longer lists these, so their queued downloads could only fail
|
||||
removedChapters.mapNotNull { downloadManager.getQueuedDownloadOrNull(it.id) }
|
||||
.takeIf { it.isNotEmpty() }
|
||||
?.let(downloadManager::cancelQueuedDownloads)
|
||||
|
||||
// Return if there's nothing to add, delete, or update to avoid unnecessary db transactions.
|
||||
if (newChapters.isEmpty() && removedChapters.isEmpty() && updatedChapters.isEmpty()) {
|
||||
if (manualFetch || manga.fetchInterval == 0 || manga.nextUpdate < fetchWindow.first) {
|
||||
|
||||
Reference in New Issue
Block a user