mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-12-25 02:31:52 +01:00
Crash log no long shows cancelled jobs exceptions for updates
This commit is contained in:
parent
f0b0d3d197
commit
1d3763a34d
@ -40,6 +40,7 @@ import eu.kanade.tachiyomi.util.lang.chop
|
|||||||
import eu.kanade.tachiyomi.util.system.executeOnIO
|
import eu.kanade.tachiyomi.util.system.executeOnIO
|
||||||
import eu.kanade.tachiyomi.util.system.notification
|
import eu.kanade.tachiyomi.util.system.notification
|
||||||
import eu.kanade.tachiyomi.util.system.notificationManager
|
import eu.kanade.tachiyomi.util.system.notificationManager
|
||||||
|
import kotlinx.coroutines.CancellationException
|
||||||
import kotlinx.coroutines.CoroutineExceptionHandler
|
import kotlinx.coroutines.CoroutineExceptionHandler
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.GlobalScope
|
import kotlinx.coroutines.GlobalScope
|
||||||
@ -238,11 +239,15 @@ class LibraryUpdateService(
|
|||||||
Timber.e(exception)
|
Timber.e(exception)
|
||||||
}
|
}
|
||||||
GlobalScope.launch(handler) {
|
GlobalScope.launch(handler) {
|
||||||
val hasDLs = requestSemaphore.withPermit {
|
val hasDLs = try {
|
||||||
|
requestSemaphore.withPermit {
|
||||||
updateMangaInSource(
|
updateMangaInSource(
|
||||||
it.key, downloadNew, categoriesToDownload
|
it.key, downloadNew, categoriesToDownload
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
} catch (e: Exception) {
|
||||||
|
false
|
||||||
|
}
|
||||||
hasDownloads = hasDownloads || hasDLs
|
hasDownloads = hasDownloads || hasDLs
|
||||||
jobCount.andDecrement
|
jobCount.andDecrement
|
||||||
finishUpdates()
|
finishUpdates()
|
||||||
@ -447,7 +452,7 @@ class LibraryUpdateService(
|
|||||||
try {
|
try {
|
||||||
var hasDownloads = false
|
var hasDownloads = false
|
||||||
if (job?.isCancelled == true) {
|
if (job?.isCancelled == true) {
|
||||||
throw java.lang.Exception("Job was cancelled")
|
return false
|
||||||
}
|
}
|
||||||
showProgressNotification(manga, progress, mangaToUpdate.size)
|
showProgressNotification(manga, progress, mangaToUpdate.size)
|
||||||
val source = sourceManager.get(manga.source) as? HttpSource ?: return false
|
val source = sourceManager.get(manga.source) as? HttpSource ?: return false
|
||||||
@ -478,7 +483,9 @@ class LibraryUpdateService(
|
|||||||
}
|
}
|
||||||
return hasDownloads
|
return hasDownloads
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
|
if (e !is CancellationException) {
|
||||||
Timber.e("Failed updating: ${manga.title}: $e")
|
Timber.e("Failed updating: ${manga.title}: $e")
|
||||||
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user