From 2270d3d8e3c9951467e797370b14ca32907b6891 Mon Sep 17 00:00:00 2001 From: arkon Date: Sat, 6 Feb 2021 12:14:55 -0500 Subject: [PATCH] Do a regular return to cancel update jobs instead of throwing an exception (cherry picked from commit e8c35ae4e1d93a814bb19283f5013de02096e2c9) # Conflicts: # app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateService.kt --- .../tachiyomi/data/library/LibraryUpdateService.kt | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateService.kt b/app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateService.kt index 66e45071e..a1bda28b1 100755 --- a/app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateService.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateService.kt @@ -48,7 +48,6 @@ import exh.source.getMainSource import exh.source.mangaDexSourceIds import exh.util.executeOnIO import exh.util.nullIfBlank -import kotlinx.coroutines.CancellationException import kotlinx.coroutines.CoroutineExceptionHandler import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers @@ -345,7 +344,7 @@ class LibraryUpdateService( mangaInSource .map { manga -> if (updateJob?.isActive != true) { - throw CancellationException() + return@async } // Notify manga that will update. @@ -477,7 +476,7 @@ class LibraryUpdateService( mangaToUpdate.forEach { manga -> if (updateJob?.isActive != true) { - throw CancellationException() + return } notifier.showProgressNotification(manga, progressCount++, mangaToUpdate.size) @@ -511,7 +510,7 @@ class LibraryUpdateService( mangaToUpdate.forEach { manga -> if (updateJob?.isActive != true) { - throw CancellationException() + return } // Notify manga that will update. @@ -556,7 +555,7 @@ class LibraryUpdateService( mangadexFollows.forEach { (networkManga, metadata) -> if (updateJob?.isActive != true) { - throw CancellationException() + return } notifier.showProgressNotification(networkManga, count.andIncrement, mangadexFollows.size) @@ -595,7 +594,7 @@ class LibraryUpdateService( if (trackManager.mdList.isLogged) { listManga.forEach { manga -> if (updateJob?.isActive != true) { - throw CancellationException() + return } notifier.showProgressNotification(manga, count.andIncrement, listManga.size)