From 43daabde6b23e9e73d3857831e46fc66c433cdf0 Mon Sep 17 00:00:00 2001 From: Gauthier Roebroeck Date: Wed, 21 Aug 2019 10:40:46 +0800 Subject: [PATCH] catch async exceptions --- .../org/gotson/komga/domain/service/LibraryManager.kt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/komga/src/main/kotlin/org/gotson/komga/domain/service/LibraryManager.kt b/komga/src/main/kotlin/org/gotson/komga/domain/service/LibraryManager.kt index 3c76d121..f7dba113 100644 --- a/komga/src/main/kotlin/org/gotson/komga/domain/service/LibraryManager.kt +++ b/komga/src/main/kotlin/org/gotson/komga/domain/service/LibraryManager.kt @@ -87,7 +87,13 @@ class LibraryManager( measureTimeMillis { sumOfTasksTime = booksToParse .map { bookManager.parseAndPersist(it) } - .map { it.get() } + .map { + try { + it.get() + } catch (ex: Exception) { + 0L + } + } .sum() }.also { logger.info { "Parsed ${booksToParse.size} books in ${DurationFormatUtils.formatDurationHMS(it)} (virtual: ${DurationFormatUtils.formatDurationHMS(sumOfTasksTime)})" }