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
This commit is contained in:
parent
bc9602a0f2
commit
2270d3d8e3
@ -48,7 +48,6 @@ import exh.source.getMainSource
|
|||||||
import exh.source.mangaDexSourceIds
|
import exh.source.mangaDexSourceIds
|
||||||
import exh.util.executeOnIO
|
import exh.util.executeOnIO
|
||||||
import exh.util.nullIfBlank
|
import exh.util.nullIfBlank
|
||||||
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
|
||||||
@ -345,7 +344,7 @@ class LibraryUpdateService(
|
|||||||
mangaInSource
|
mangaInSource
|
||||||
.map { manga ->
|
.map { manga ->
|
||||||
if (updateJob?.isActive != true) {
|
if (updateJob?.isActive != true) {
|
||||||
throw CancellationException()
|
return@async
|
||||||
}
|
}
|
||||||
|
|
||||||
// Notify manga that will update.
|
// Notify manga that will update.
|
||||||
@ -477,7 +476,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)
|
||||||
@ -511,7 +510,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.
|
||||||
@ -556,7 +555,7 @@ class LibraryUpdateService(
|
|||||||
|
|
||||||
mangadexFollows.forEach { (networkManga, metadata) ->
|
mangadexFollows.forEach { (networkManga, metadata) ->
|
||||||
if (updateJob?.isActive != true) {
|
if (updateJob?.isActive != true) {
|
||||||
throw CancellationException()
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
notifier.showProgressNotification(networkManga, count.andIncrement, mangadexFollows.size)
|
notifier.showProgressNotification(networkManga, count.andIncrement, mangadexFollows.size)
|
||||||
@ -595,7 +594,7 @@ class LibraryUpdateService(
|
|||||||
if (trackManager.mdList.isLogged) {
|
if (trackManager.mdList.isLogged) {
|
||||||
listManga.forEach { manga ->
|
listManga.forEach { manga ->
|
||||||
if (updateJob?.isActive != true) {
|
if (updateJob?.isActive != true) {
|
||||||
throw CancellationException()
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
notifier.showProgressNotification(manga, count.andIncrement, listManga.size)
|
notifier.showProgressNotification(manga, count.andIncrement, listManga.size)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user