From 9a50f2e4089c6766388adefc397f8fd59bcc063c Mon Sep 17 00:00:00 2001 From: schroda <50052685+schroda@users.noreply.github.com> Date: Mon, 27 Mar 2023 15:41:19 +0200 Subject: [PATCH] Notify clients even if no manga gets updated (#531) In case no manga gets updated and no update job was running before, the client would never receive an info about its update request --- .../tachidesk/manga/controller/UpdateController.kt | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/server/src/main/kotlin/suwayomi/tachidesk/manga/controller/UpdateController.kt b/server/src/main/kotlin/suwayomi/tachidesk/manga/controller/UpdateController.kt index 85b78a8a..172c7d96 100644 --- a/server/src/main/kotlin/suwayomi/tachidesk/manga/controller/UpdateController.kt +++ b/server/src/main/kotlin/suwayomi/tachidesk/manga/controller/UpdateController.kt @@ -93,13 +93,20 @@ object UpdateController { if (clear) { updater.reset() } - updater.addMangasToQueue( - categories + + val mangasToUpdate = categories .flatMap { CategoryManga.getCategoryMangaList(it.id) } .distinctBy { it.id } .sortedWith(compareBy(String.CASE_INSENSITIVE_ORDER, MangaDataClass::title)) .filter { it.updateStrategy == UpdateStrategy.ALWAYS_UPDATE } - ) + + // In case no manga gets updated and no update job was running before, the client would never receive an info about its update request + if (mangasToUpdate.isEmpty()) { + UpdaterSocket.notifyAllClients(UpdateStatus()) + return + } + + updater.addMangasToQueue(mangasToUpdate) } fun categoryUpdateWS(ws: WsConfig) {