fix concurrent download (#1387)

* Fix concurrent download

* lower Concurrency

* artist Update app/src/main/java/eu/kanade/tachiyomi/data/download/Downloader.kt

Co-authored-by: Vetle Ledaal <vetle.ledaal@gmail.com>

Co-authored-by: Vetle Ledaal <vetle.ledaal@gmail.com>
(cherry picked from commit b635f02d93)

Co-authored-by: f1998f1998 <71004883+f1998f1998@users.noreply.github.com>
This commit is contained in:
nzoba 2022-08-22 19:03:45 +02:00 committed by GitHub
parent 655ac93a56
commit ca7a315a03
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -370,8 +370,8 @@ class Downloader(
// Get all the URLs to the source images, fetch pages if necessary // Get all the URLs to the source images, fetch pages if necessary
.flatMap { download.source.fetchAllImageUrlsFromPageList(it) } .flatMap { download.source.fetchAllImageUrlsFromPageList(it) }
// Start downloading images, consider we can have downloaded images already // Start downloading images, consider we can have downloaded images already
// Concurrently do 5 pages at a time // Concurrently do 2 pages at a time
.flatMap({ page -> getOrDownloadImage(page, download, tmpDir) }, 5) .flatMap({ page -> getOrDownloadImage(page, download, tmpDir).subscribeOn(Schedulers.io()) }, 2)
.onBackpressureLatest() .onBackpressureLatest()
// Do when page is downloaded. // Do when page is downloaded.
.doOnNext { notifier.onProgressChange(download) } .doOnNext { notifier.onProgressChange(download) }