catch async exceptions

This commit is contained in:
Gauthier Roebroeck 2019-08-21 10:40:46 +08:00
parent c0fc4aba0e
commit 43daabde6b

View File

@ -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)})" }