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
This commit is contained in:
schroda
2023-03-27 15:41:19 +02:00
committed by GitHub
parent dcde4947e8
commit 9a50f2e408

View File

@@ -93,13 +93,20 @@ object UpdateController {
if (clear) { if (clear) {
updater.reset() updater.reset()
} }
updater.addMangasToQueue(
categories val mangasToUpdate = categories
.flatMap { CategoryManga.getCategoryMangaList(it.id) } .flatMap { CategoryManga.getCategoryMangaList(it.id) }
.distinctBy { it.id } .distinctBy { it.id }
.sortedWith(compareBy(String.CASE_INSENSITIVE_ORDER, MangaDataClass::title)) .sortedWith(compareBy(String.CASE_INSENSITIVE_ORDER, MangaDataClass::title))
.filter { it.updateStrategy == UpdateStrategy.ALWAYS_UPDATE } .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) { fun categoryUpdateWS(ws: WsConfig) {