From 9e4443765b77f503177871cfc68d3252dd0e4206 Mon Sep 17 00:00:00 2001 From: Gauthier Roebroeck Date: Mon, 22 Mar 2021 15:06:50 +0800 Subject: [PATCH] fix: refresh series metadata and aggregation after book deletion in some cases the series metadata and aggregation could be incorrect after a book deletion --- .../gotson/komga/domain/service/LibraryContentLifecycle.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/komga/src/main/kotlin/org/gotson/komga/domain/service/LibraryContentLifecycle.kt b/komga/src/main/kotlin/org/gotson/komga/domain/service/LibraryContentLifecycle.kt index cec63ceaa..1dc69ba0d 100644 --- a/komga/src/main/kotlin/org/gotson/komga/domain/service/LibraryContentLifecycle.kt +++ b/komga/src/main/kotlin/org/gotson/komga/domain/service/LibraryContentLifecycle.kt @@ -21,7 +21,8 @@ class LibraryContentLifecycle( private val bookRepository: BookRepository, private val bookLifecycle: BookLifecycle, private val mediaRepository: MediaRepository, - private val seriesLifecycle: SeriesLifecycle + private val seriesLifecycle: SeriesLifecycle, + private val taskReceiver: TaskReceiver, ) { fun scanRootFolder(library: Library) { @@ -101,6 +102,7 @@ class LibraryContentLifecycle( .let { books -> logger.info { "Deleting books not on disk anymore: $books" } bookLifecycle.deleteMany(books.map { it.id }) + books.map { it.seriesId }.distinct().forEach { taskReceiver.refreshSeriesMetadata(it) } } // add new books