mirror of
https://github.com/gotson/komga.git
synced 2025-12-06 08:32:25 +01:00
perf: send events outside of db transaction
This commit is contained in:
parent
3f64435afa
commit
51bfb353e7
2 changed files with 6 additions and 6 deletions
|
|
@ -109,14 +109,14 @@ class ReadListLifecycle(
|
|||
|
||||
fun deleteEmptyReadLists() {
|
||||
logger.info { "Deleting empty read lists" }
|
||||
transactionTemplate.executeWithoutResult {
|
||||
val toDelete = readListRepository.findAllEmpty()
|
||||
transactionTemplate.executeWithoutResult {
|
||||
thumbnailReadListRepository.deleteByReadListIds(toDelete.map { it.id })
|
||||
readListRepository.delete(toDelete.map { it.id })
|
||||
}
|
||||
|
||||
toDelete.forEach { eventPublisher.publishEvent(DomainEvent.ReadListDeleted(it)) }
|
||||
}
|
||||
}
|
||||
|
||||
fun addThumbnail(thumbnail: ThumbnailReadList): ThumbnailReadList {
|
||||
when (thumbnail.type) {
|
||||
|
|
|
|||
|
|
@ -95,14 +95,14 @@ class SeriesCollectionLifecycle(
|
|||
|
||||
fun deleteEmptyCollections() {
|
||||
logger.info { "Deleting empty collections" }
|
||||
transactionTemplate.executeWithoutResult {
|
||||
val toDelete = collectionRepository.findAllEmpty()
|
||||
transactionTemplate.executeWithoutResult {
|
||||
thumbnailSeriesCollectionRepository.deleteByCollectionIds(toDelete.map { it.id })
|
||||
collectionRepository.delete(toDelete.map { it.id })
|
||||
}
|
||||
|
||||
toDelete.forEach { eventPublisher.publishEvent(DomainEvent.CollectionDeleted(it)) }
|
||||
}
|
||||
}
|
||||
|
||||
fun addThumbnail(thumbnail: ThumbnailSeriesCollection): ThumbnailSeriesCollection {
|
||||
when (thumbnail.type) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue