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:
AntsyLich
2026-10-10 17:36:20 +06:00
co-authored by Joseph
parent 287cbbb986
commit f28b2d887e
@@ -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) {