mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-19 22:59:18 +01:00
Do library checks from up to 5 sources concurrently
This commit is contained in:
parent
c9035b5df9
commit
f853158e6b
@ -308,9 +308,13 @@ class LibraryUpdateService(
|
||||
|
||||
// Emit each manga and update it sequentially.
|
||||
return Observable.from(mangaToUpdate)
|
||||
// Update the chapters of the manga concurrently from 5 different sources
|
||||
.groupBy { it.source }
|
||||
.flatMap(
|
||||
{ bySource ->
|
||||
bySource
|
||||
// Notify manga that will update.
|
||||
.doOnNext { showProgressNotification(it, count.andIncrement, mangaToUpdate.size) }
|
||||
// Update the chapters of the manga.
|
||||
.concatMap { manga ->
|
||||
updateManga(manga)
|
||||
// If there's any error, return empty update and continue.
|
||||
@ -334,10 +338,16 @@ class LibraryUpdateService(
|
||||
.map {
|
||||
Pair(
|
||||
manga,
|
||||
(it.first.sortedByDescending { ch -> ch.source_order }.toTypedArray())
|
||||
(
|
||||
it.first.sortedByDescending { ch -> ch.source_order }
|
||||
.toTypedArray()
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
},
|
||||
5
|
||||
)
|
||||
// Add manga with new chapters to the list.
|
||||
.doOnNext { manga ->
|
||||
// Add to the list
|
||||
@ -397,9 +407,13 @@ class LibraryUpdateService(
|
||||
|
||||
// Emit each manga and update it sequentially.
|
||||
return Observable.from(mangaToUpdate)
|
||||
// Update the details of the manga concurrently from 5 different sources
|
||||
.groupBy { it.source }
|
||||
.flatMap(
|
||||
{ bySource ->
|
||||
bySource
|
||||
// Notify manga that will update.
|
||||
.doOnNext { showProgressNotification(it, count.andIncrement, mangaToUpdate.size) }
|
||||
// Update the details of the manga.
|
||||
.concatMap { manga ->
|
||||
val source = sourceManager.get(manga.source) as? HttpSource
|
||||
?: return@concatMap Observable.empty<LibraryManga>()
|
||||
@ -412,6 +426,9 @@ class LibraryUpdateService(
|
||||
}
|
||||
.onErrorReturn { manga }
|
||||
}
|
||||
},
|
||||
5
|
||||
)
|
||||
.doOnCompleted {
|
||||
cancelProgressNotification()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user