Do a regular return to cancel update jobs instead of throwing an exception

This commit is contained in:
arkon 2021-02-06 12:14:55 -05:00
parent 1607658c30
commit e8c35ae4e1

View File

@ -33,7 +33,6 @@ import eu.kanade.tachiyomi.util.storage.getUriCompat
import eu.kanade.tachiyomi.util.system.acquireWakeLock import eu.kanade.tachiyomi.util.system.acquireWakeLock
import eu.kanade.tachiyomi.util.system.createFileInCacheDir import eu.kanade.tachiyomi.util.system.createFileInCacheDir
import eu.kanade.tachiyomi.util.system.isServiceRunning import eu.kanade.tachiyomi.util.system.isServiceRunning
import kotlinx.coroutines.CancellationException
import kotlinx.coroutines.CoroutineExceptionHandler import kotlinx.coroutines.CoroutineExceptionHandler
import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
@ -257,7 +256,7 @@ class LibraryUpdateService(
mangaToUpdate mangaToUpdate
.map { manga -> .map { manga ->
if (updateJob?.isActive != true) { if (updateJob?.isActive != true) {
throw CancellationException() return
} }
// Notify manga that will update. // Notify manga that will update.
@ -360,7 +359,7 @@ class LibraryUpdateService(
mangaToUpdate.forEach { manga -> mangaToUpdate.forEach { manga ->
if (updateJob?.isActive != true) { if (updateJob?.isActive != true) {
throw CancellationException() return
} }
notifier.showProgressNotification(manga, progressCount++, mangaToUpdate.size) notifier.showProgressNotification(manga, progressCount++, mangaToUpdate.size)
@ -394,7 +393,7 @@ class LibraryUpdateService(
mangaToUpdate.forEach { manga -> mangaToUpdate.forEach { manga ->
if (updateJob?.isActive != true) { if (updateJob?.isActive != true) {
throw CancellationException() return
} }
// Notify manga that will update. // Notify manga that will update.