mirror of
https://github.com/Suwayomi/Suwayomi-Server.git
synced 2026-07-12 07:14:35 -05:00
Initialize manga on add to library (#1016)
In case a manga gets added to the library which has not been initialized yet, it should be tried to initialize it. Since it's not an error to have uninitialized manga in the library, this can be done in the background via the updater and the client receives the updated data via the update subscription.
This commit is contained in:
@@ -3,6 +3,7 @@ package suwayomi.tachidesk.manga.impl.update
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
import kotlinx.coroutines.flow.StateFlow
|
||||
import suwayomi.tachidesk.manga.model.dataclass.CategoryDataClass
|
||||
import suwayomi.tachidesk.manga.model.dataclass.MangaDataClass
|
||||
|
||||
interface IUpdater {
|
||||
fun getLastUpdateTimestamp(): Long
|
||||
@@ -13,6 +14,8 @@ interface IUpdater {
|
||||
forceAll: Boolean,
|
||||
)
|
||||
|
||||
fun addMangasToQueue(mangas: List<MangaDataClass>)
|
||||
|
||||
val status: Flow<UpdateStatus>
|
||||
|
||||
val statusDeprecated: StateFlow<UpdateStatus>
|
||||
|
||||
@@ -329,11 +329,11 @@ class Updater : IUpdater {
|
||||
)
|
||||
}
|
||||
|
||||
private fun addMangasToQueue(mangasToUpdate: List<MangaDataClass>) {
|
||||
override fun addMangasToQueue(mangas: List<MangaDataClass>) {
|
||||
// create all manga update jobs before adding them to the queue so that the client is able to calculate the
|
||||
// progress properly right form the start
|
||||
mangasToUpdate.forEach { tracker[it.id] = UpdateJob(it) }
|
||||
mangasToUpdate.forEach { addMangaToQueue(it) }
|
||||
mangas.forEach { tracker[it.id] = UpdateJob(it) }
|
||||
mangas.forEach { addMangaToQueue(it) }
|
||||
}
|
||||
|
||||
private fun addMangaToQueue(manga: MangaDataClass) {
|
||||
|
||||
Reference in New Issue
Block a user