From 150132f4dd40020c3cbc8f72d5a7d63dc695d2b3 Mon Sep 17 00:00:00 2001 From: arkon Date: Fri, 8 May 2020 18:16:27 -0400 Subject: [PATCH] Concurrently download up to 5 pages at a time --- .../main/java/eu/kanade/tachiyomi/data/download/Downloader.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/download/Downloader.kt b/app/src/main/java/eu/kanade/tachiyomi/data/download/Downloader.kt index 0fbe816b1..c6bc9a65a 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/download/Downloader.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/download/Downloader.kt @@ -289,7 +289,8 @@ class Downloader( // Get all the URLs to the source images, fetch pages if necessary .flatMap { download.source.fetchAllImageUrlsFromPageList(it) } // Start downloading images, consider we can have downloaded images already - .concatMap { page -> getOrDownloadImage(page, download, tmpDir) } + // Concurrently do 5 pages at a time + .flatMap({ page -> getOrDownloadImage(page, download, tmpDir) }, 5) // Do when page is downloaded. .doOnNext { notifier.onProgressChange(download) } .toList()