From 9754f66f22add1197d65f3711c1731c2ea1cfaf2 Mon Sep 17 00:00:00 2001 From: Tonyo Francis Date: Tue, 9 Jan 2018 16:51:34 -0500 Subject: [PATCH] fixed slow downloading speeds on some devices --- CHANGELOG | 3 ++ README.md | 10 +++---- fetch2/build.gradle | 6 ++-- .../fetch2/DatabaseInstrumentedTest.java | 27 +++++++++++++++-- .../fetch2/database/DatabaseManager.kt | 2 +- .../fetch2/database/DatabaseManagerImpl.kt | 26 ++++++++++++++++ .../fetch2/database/DownloadDatabase.kt | 13 ++++++++ .../tonyodev/fetch2/database/DownloadInfo.kt | 30 +++++++++---------- .../fetch2/downloader/FileDownloader.kt | 3 +- .../fetch2/downloader/FileDownloaderImpl.kt | 26 ++++++++-------- .../helper/DownloadInfoManagerDelegate.kt | 15 ++++------ .../fetch2/helper/DownloadInfoUpdater.kt | 4 +++ fetch2downloaders/build.gradle | 6 ++-- fetch2rx/build.gradle | 6 ++-- fetchmigrator/build.gradle | 6 ++-- sampleApp/build.gradle | 4 +-- .../main/java/com/tonyodev/fetchapp/App.java | 1 - 17 files changed, 125 insertions(+), 63 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 1e83c808..fa472199 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,6 @@ +Version 2.0.0-RC4 +- Fixed slow downloading speeds on some devices. + Version 2.0.0-RC3 - Fix compile and build issue for non Kotlin projects. - Minor changes for rxFetch. diff --git a/README.md b/README.md index 40e2cc52..16defa3c 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ [![Build Status](https://travis-ci.org/tonyofrancis/Fetch.svg?branch=v2)](https://travis-ci.org/tonyofrancis/Fetch) -[ ![Download](https://api.bintray.com/packages/tonyofrancis/maven/fetch2/images/download.svg?version=2.0.0-RC3) ](https://bintray.com/tonyofrancis/maven/fetch2/2.0.0-RC3/link) +[ ![Download](https://api.bintray.com/packages/tonyofrancis/maven/fetch2/images/download.svg?version=2.0.0-RC4) ](https://bintray.com/tonyofrancis/maven/fetch2/2.0.0-RC4/link) [![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-Android%20Networking-blue.svg?style=flat)](https://android-arsenal.com/details/1/5196) [![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://github.com/tonyofrancis/Fetch/blob/master/LICENSE) @@ -43,7 +43,7 @@ How to use Fetch Using Fetch is easy! Just add the Gradle dependency to your application's build.gradle file. ```java -implementation "com.tonyodev.fetch2:fetch2:2.0.0-RC3" +implementation "com.tonyodev.fetch2:fetch2:2.0.0-RC4" ``` Next, get an instance of Fetch using the builder, and request a download. @@ -234,7 +234,7 @@ to use the OkHttp Downloader instead. You can create your own custom downloaders if necessary. See the Java docs for details. ```java -implementation "com.tonyodev.fetch2downloaders:fetch2downloaders:2.0.0-RC3" +implementation "com.tonyodev.fetch2downloaders:fetch2downloaders:2.0.0-RC4" ``` Set the OkHttp Downloader for Fetch to use. ```java @@ -255,7 +255,7 @@ If you would like to take advantage of RxJava2 features when using Fetch, add the following gradle dependency to your application's build.gradle file. ```java -implementation "com.tonyodev.fetch2rx:fetch2rx:2.0.0-RC3" +implementation "com.tonyodev.fetch2rx:fetch2rx:2.0.0-RC4" ``` RxFetch makes it super easy to enqueue download requests and query downloads using rxJava2 functional methods. @@ -287,7 +287,7 @@ Fetch1 Migration Migrate downloads from Fetch1 to Fetch2 using the migration assistant. Add the following gradle dependency to your application's build.gradle file. ```java -implementation "com.tonyodev.fetchmigrator:fetchmigrator:2.0.0-RC3" +implementation "com.tonyodev.fetchmigrator:fetchmigrator:2.0.0-RC4" ``` Then run the Migrator. diff --git a/fetch2/build.gradle b/fetch2/build.gradle index 60a9b41b..d1b0ed02 100644 --- a/fetch2/build.gradle +++ b/fetch2/build.gradle @@ -23,8 +23,8 @@ android { defaultConfig { minSdkVersion library_min_version targetSdkVersion library_target_version - versionCode 4 - versionName "2.0.0-RC3" + versionCode 5 + versionName "2.0.0-RC4" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" @@ -72,7 +72,7 @@ publish { userOrg = 'tonyofrancis' groupId = 'com.tonyodev.fetch2' artifactId = 'fetch2' - publishVersion = '2.0.0-RC3' + publishVersion = '2.0.0-RC4' desc = 'Fetch is a simple, powerful, customizable file download manager library for Android.' website = 'https://github.com/tonyofrancis/fetch' } diff --git a/fetch2/src/androidTest/java/com/tonyodev/fetch2/DatabaseInstrumentedTest.java b/fetch2/src/androidTest/java/com/tonyodev/fetch2/DatabaseInstrumentedTest.java index 529d23c2..ce0cd774 100644 --- a/fetch2/src/androidTest/java/com/tonyodev/fetch2/DatabaseInstrumentedTest.java +++ b/fetch2/src/androidTest/java/com/tonyodev/fetch2/DatabaseInstrumentedTest.java @@ -133,7 +133,7 @@ public void deleteMulti() throws Exception { databaseManager.insert(downloadInfoList); databaseManager.delete(downloadInfoList); final List ids = new ArrayList<>(); - for(DownloadInfo downloadInfo : downloadInfoList) { + for (DownloadInfo downloadInfo : downloadInfoList) { ids.add(downloadInfo.getId()); } final List queryList = databaseManager.get(ids); @@ -188,7 +188,7 @@ public void updateMulti() throws Exception { } databaseManager.update(downloadInfoList); final List ids = new ArrayList<>(); - for(DownloadInfo downloadInfo : downloadInfoList) { + for (DownloadInfo downloadInfo : downloadInfoList) { ids.add(downloadInfo.getId()); } final List queryList = databaseManager.get(ids); @@ -254,7 +254,7 @@ public void getIds() throws Exception { } databaseManager.insert(downloadInfoList); final List ids = new ArrayList<>(); - for(DownloadInfo downloadInfo : downloadInfoList) { + for (DownloadInfo downloadInfo : downloadInfoList) { ids.add(downloadInfo.getId()); } final List queryList = databaseManager.get(ids); @@ -380,6 +380,27 @@ public void getGroupWithStatus() throws Exception { } } + @Test + public void fileUpdate() throws Exception { + databaseManager.deleteAll(); + final Request request = getTestRequest(); + final DownloadInfo downloadInfo = FetchTypeConverterExtensions.toDownloadInfo(request); + final Pair pair = databaseManager.insert(downloadInfo); + assertTrue(pair.getSecond()); + final long downloaded = 2000; + final long total = Long.MAX_VALUE; + final Status status = Status.DOWNLOADING; + downloadInfo.setDownloaded(downloaded); + downloadInfo.setTotal(total); + downloadInfo.setStatus(status); + databaseManager.updateFileBytesInfoAndStatusOnly(downloadInfo); + final DownloadInfo downloadInfo1 = databaseManager.get(downloadInfo.getId()); + assertNotNull(downloadInfo1); + assertEquals(downloaded, downloadInfo1.getDownloaded()); + assertEquals(total, downloadInfo1.getTotal()); + assertEquals(status, downloadInfo1.getStatus()); + } + @Test public void closed() throws Exception { assertFalse(databaseManager.isClosed()); diff --git a/fetch2/src/main/java/com/tonyodev/fetch2/database/DatabaseManager.kt b/fetch2/src/main/java/com/tonyodev/fetch2/database/DatabaseManager.kt index 65414184..41c8c805 100644 --- a/fetch2/src/main/java/com/tonyodev/fetch2/database/DatabaseManager.kt +++ b/fetch2/src/main/java/com/tonyodev/fetch2/database/DatabaseManager.kt @@ -18,11 +18,11 @@ interface DatabaseManager : Closeable { fun deleteAll() fun update(downloadInfo: DownloadInfo) fun update(downloadInfoList: List) + fun updateFileBytesInfoAndStatusOnly(downloadInfo: DownloadInfo) fun get(): List fun get(id: Int): DownloadInfo? fun get(ids: List): List fun getByStatus(status: Status): List fun getByGroup(group: Int): List fun getDownloadsInGroupWithStatus(groupId: Int, status: Status): List - } \ No newline at end of file diff --git a/fetch2/src/main/java/com/tonyodev/fetch2/database/DatabaseManagerImpl.kt b/fetch2/src/main/java/com/tonyodev/fetch2/database/DatabaseManagerImpl.kt index b3544afe..23578b84 100644 --- a/fetch2/src/main/java/com/tonyodev/fetch2/database/DatabaseManagerImpl.kt +++ b/fetch2/src/main/java/com/tonyodev/fetch2/database/DatabaseManagerImpl.kt @@ -2,9 +2,12 @@ package com.tonyodev.fetch2.database import android.arch.persistence.room.Room import android.content.Context +import android.database.sqlite.SQLiteException import com.tonyodev.fetch2.Logger import com.tonyodev.fetch2.Status import com.tonyodev.fetch2.exception.FetchImplementationException +import android.arch.persistence.room.RoomMasterTable.TABLE_NAME + open class DatabaseManagerImpl constructor(context: Context, val namespace: String, @@ -87,6 +90,29 @@ open class DatabaseManagerImpl constructor(context: Context, } } + override fun updateFileBytesInfoAndStatusOnly(downloadInfo: DownloadInfo) { + synchronized(lock) { + throwExceptionIfClosed() + val database = requestDatabaseInternal.openHelper.writableDatabase + try { + database.beginTransaction() + database.execSQL("UPDATE ${DownloadDatabase.TABLE_NAME} SET " + + "${DownloadDatabase.COLUMN_DOWNLOADED} = ${downloadInfo.downloaded}, " + + "${DownloadDatabase.COLUMN_TOTAL} = ${downloadInfo.total}, " + + "${DownloadDatabase.COLUMN_STATUS} = ${downloadInfo.status.value} " + + "WHERE ${DownloadDatabase.COLUMN_ID} = ${downloadInfo.id}") + database.setTransactionSuccessful() + } catch (e: SQLiteException) { + logger.e("DatabaseManager exception", e) + } + try { + database.endTransaction() + } catch (e: SQLiteException) { + logger.e("DatabaseManager exception", e) + } + } + } + override fun get(): List { synchronized(lock) { throwExceptionIfClosed() diff --git a/fetch2/src/main/java/com/tonyodev/fetch2/database/DownloadDatabase.kt b/fetch2/src/main/java/com/tonyodev/fetch2/database/DownloadDatabase.kt index 0f0a9950..7c9f0deb 100644 --- a/fetch2/src/main/java/com/tonyodev/fetch2/database/DownloadDatabase.kt +++ b/fetch2/src/main/java/com/tonyodev/fetch2/database/DownloadDatabase.kt @@ -16,6 +16,19 @@ abstract class DownloadDatabase : RoomDatabase() { companion object { const val TABLE_NAME = "requests" + const val COLUMN_ID = "_id" + const val COLUMN_NAMESPACE = "_namespace" + const val COLUMN_URL = "_url" + const val COLUMN_FILE = "_file" + const val COLUMN_GROUP = "_group" + const val COLUMN_PRIORITY = "_priority" + const val COLUMN_HEADERS = "_headers" + const val COLUMN_DOWNLOADED = "_written_bytes" + const val COLUMN_TOTAL = "_total_bytes" + const val COLUMN_STATUS = "_status" + const val COLUMN_ERROR = "_error" + const val COLUMN_NETWORK_TYPE = "_network_type" + const val COLUMN_CREATED = "_created" } } \ No newline at end of file diff --git a/fetch2/src/main/java/com/tonyodev/fetch2/database/DownloadInfo.kt b/fetch2/src/main/java/com/tonyodev/fetch2/database/DownloadInfo.kt index 39c317ac..faee648d 100644 --- a/fetch2/src/main/java/com/tonyodev/fetch2/database/DownloadInfo.kt +++ b/fetch2/src/main/java/com/tonyodev/fetch2/database/DownloadInfo.kt @@ -15,48 +15,48 @@ import java.util.Date @Entity(tableName = DownloadDatabase.TABLE_NAME, - indices = [(Index(value = ["_file"], unique = true)), - (Index(value = ["_group", "_status"], unique = false))]) + indices = [(Index(value = [DownloadDatabase.COLUMN_FILE], unique = true)), + (Index(value = [DownloadDatabase.COLUMN_GROUP, DownloadDatabase.COLUMN_STATUS], unique = false))]) class DownloadInfo : Download { @PrimaryKey - @ColumnInfo(name = "_id") + @ColumnInfo(name = DownloadDatabase.COLUMN_ID) override var id: Int = 0 - @ColumnInfo(name = "_namespace") + @ColumnInfo(name = DownloadDatabase.COLUMN_NAMESPACE) override var namespace: String = "" - @ColumnInfo(name = "_url") + @ColumnInfo(name = DownloadDatabase.COLUMN_URL) override var url: String = "" - @ColumnInfo(name = "_file") + @ColumnInfo(name = DownloadDatabase.COLUMN_FILE) override var file: String = "" - @ColumnInfo(name = "_group") + @ColumnInfo(name = DownloadDatabase.COLUMN_GROUP) override var group: Int = 0 - @ColumnInfo(name = "_priority") + @ColumnInfo(name = DownloadDatabase.COLUMN_PRIORITY) override var priority: Priority = defaultPriority - @ColumnInfo(name = "_headers") + @ColumnInfo(name = DownloadDatabase.COLUMN_HEADERS) override var headers: Map = defaultEmptyHeaderMap - @ColumnInfo(name = "_written_bytes") + @ColumnInfo(name = DownloadDatabase.COLUMN_DOWNLOADED) override var downloaded: Long = 0L - @ColumnInfo(name = "_total_bytes") + @ColumnInfo(name = DownloadDatabase.COLUMN_TOTAL) override var total: Long = -1L - @ColumnInfo(name = "_status") + @ColumnInfo(name = DownloadDatabase.COLUMN_STATUS) override var status: Status = defaultStatus - @ColumnInfo(name = "_error") + @ColumnInfo(name = DownloadDatabase.COLUMN_ERROR) override var error: Error = defaultNoError - @ColumnInfo(name = "_network_type") + @ColumnInfo(name = DownloadDatabase.COLUMN_NETWORK_TYPE) override var networkType: NetworkType = defaultNetworkType - @ColumnInfo(name = "_created") + @ColumnInfo(name = DownloadDatabase.COLUMN_CREATED) override var created: Long = Date().time override val progress: Int diff --git a/fetch2/src/main/java/com/tonyodev/fetch2/downloader/FileDownloader.kt b/fetch2/src/main/java/com/tonyodev/fetch2/downloader/FileDownloader.kt index b25daeac..eac145c2 100644 --- a/fetch2/src/main/java/com/tonyodev/fetch2/downloader/FileDownloader.kt +++ b/fetch2/src/main/java/com/tonyodev/fetch2/downloader/FileDownloader.kt @@ -16,8 +16,7 @@ interface FileDownloader : Runnable { etaInMilliseconds: Long) fun onProgress(download: Download, - etaInMilliSeconds: Long, - reportProgress: Boolean = false) + etaInMilliSeconds: Long) fun onError(download: Download) diff --git a/fetch2/src/main/java/com/tonyodev/fetch2/downloader/FileDownloaderImpl.kt b/fetch2/src/main/java/com/tonyodev/fetch2/downloader/FileDownloaderImpl.kt index f3e5bc7e..0da937ef 100644 --- a/fetch2/src/main/java/com/tonyodev/fetch2/downloader/FileDownloaderImpl.kt +++ b/fetch2/src/main/java/com/tonyodev/fetch2/downloader/FileDownloaderImpl.kt @@ -61,7 +61,7 @@ open class FileDownloaderImpl(val initialDownload: Download, logger.d("FileDownloader starting Download $download") } if (!interrupted) { - input = BufferedInputStream(response.byteStream) + input = BufferedInputStream(response.byteStream, downloadBufferSizeBytes) downloadInfoInternal.downloaded = downloadedInternal downloadInfoInternal.total = totalInternal delegate?.onStarted( @@ -131,10 +131,6 @@ open class FileDownloaderImpl(val initialDownload: Download, output.write(buffer, 0, read) downloadedInternal += read - reportingStopTime = System.nanoTime() - val hasReportingTimeElapsed = hasIntervalTimeElapsed(reportingStartTime, - reportingStopTime, progressReportingIntervalMillis) - downloadSpeedStopTime = System.nanoTime() val downloadSpeedCheckTimeElapsed = hasIntervalTimeElapsed(downloadSpeedStartTime, downloadSpeedStopTime, DEFAULT_DOWNLOAD_SPEED_REPORTING_INTERVAL_IN_MILLISECONDS) @@ -147,20 +143,24 @@ open class FileDownloaderImpl(val initialDownload: Download, downloadedBytesPerSecond = downloadedBytesPerSecond) downloadedBytesPerSecond = downloadedInternal - downloadSpeedStartTime = System.nanoTime() } + reportingStopTime = System.nanoTime() + val hasReportingTimeElapsed = hasIntervalTimeElapsed(reportingStartTime, + reportingStopTime, progressReportingIntervalMillis) + if (hasReportingTimeElapsed) { + downloadInfoInternal.downloaded = downloadedInternal + downloadInfoInternal.total = totalInternal + delegate?.onProgress( + download = downloadInfoInternal, + etaInMilliSeconds = estimatedTimeRemainingInMillisecondsInternal) reportingStartTime = System.nanoTime() } - downloadInfoInternal.downloaded = downloadedInternal - downloadInfoInternal.total = totalInternal - delegate?.onProgress( - download = downloadInfoInternal, - etaInMilliSeconds = estimatedTimeRemainingInMillisecondsInternal, - reportProgress = hasReportingTimeElapsed) - + if (downloadSpeedCheckTimeElapsed) { + downloadSpeedStartTime = System.nanoTime() + } read = input.read(buffer, 0, downloadBufferSizeBytes) } if (read == -1 && !interrupted) { diff --git a/fetch2/src/main/java/com/tonyodev/fetch2/helper/DownloadInfoManagerDelegate.kt b/fetch2/src/main/java/com/tonyodev/fetch2/helper/DownloadInfoManagerDelegate.kt index dee67db7..59830fe0 100644 --- a/fetch2/src/main/java/com/tonyodev/fetch2/helper/DownloadInfoManagerDelegate.kt +++ b/fetch2/src/main/java/com/tonyodev/fetch2/helper/DownloadInfoManagerDelegate.kt @@ -27,16 +27,13 @@ open class DownloadInfoManagerDelegate(val downloadInfoUpdater: DownloadInfoUpda } } - override fun onProgress(download: Download, etaInMilliSeconds: Long, - reportProgress: Boolean) { - val downloadInfo = download as DownloadInfo - downloadInfo.status = Status.DOWNLOADING + override fun onProgress(download: Download, etaInMilliSeconds: Long) { try { - downloadInfoUpdater.update(downloadInfo) - if (reportProgress) { - uiHandler.post { - fetchListener.onProgress(downloadInfo, etaInMilliSeconds) - } + val downloadInfo = download as DownloadInfo + downloadInfo.status = Status.DOWNLOADING + downloadInfoUpdater.updateFileBytesInfoAndStatusOnly(downloadInfo) + uiHandler.post { + fetchListener.onProgress(download, etaInMilliSeconds) } } catch (e: Exception) { logger.e("DownloadManagerDelegate", e) diff --git a/fetch2/src/main/java/com/tonyodev/fetch2/helper/DownloadInfoUpdater.kt b/fetch2/src/main/java/com/tonyodev/fetch2/helper/DownloadInfoUpdater.kt index 17fb397e..f5eb5a03 100644 --- a/fetch2/src/main/java/com/tonyodev/fetch2/helper/DownloadInfoUpdater.kt +++ b/fetch2/src/main/java/com/tonyodev/fetch2/helper/DownloadInfoUpdater.kt @@ -6,6 +6,10 @@ import com.tonyodev.fetch2.database.DownloadInfo open class DownloadInfoUpdater(val databaseManagerInternal: DatabaseManager) { + open fun updateFileBytesInfoAndStatusOnly(downloadInfo: DownloadInfo) { + databaseManagerInternal.updateFileBytesInfoAndStatusOnly(downloadInfo) + } + open fun update(downloadInfo: DownloadInfo) { databaseManagerInternal.update(downloadInfo) } diff --git a/fetch2downloaders/build.gradle b/fetch2downloaders/build.gradle index 90de37e6..d25abd7c 100644 --- a/fetch2downloaders/build.gradle +++ b/fetch2downloaders/build.gradle @@ -21,8 +21,8 @@ android { defaultConfig { minSdkVersion library_min_version targetSdkVersion library_target_version - versionCode 4 - versionName "2.0.0-RC3" + versionCode 5 + versionName "2.0.0-RC4" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" @@ -72,7 +72,7 @@ publish { userOrg = 'tonyofrancis' groupId = 'com.tonyodev.fetch2downloaders' artifactId = 'fetch2downloaders' - publishVersion = '2.0.0-RC3' + publishVersion = '2.0.0-RC4' desc = 'Downloaders for Fetch2' website = 'https://github.com/tonyofrancis/fetch' } diff --git a/fetch2rx/build.gradle b/fetch2rx/build.gradle index 9d4c19d4..d655506f 100644 --- a/fetch2rx/build.gradle +++ b/fetch2rx/build.gradle @@ -20,8 +20,8 @@ android { defaultConfig { minSdkVersion library_min_version targetSdkVersion library_target_version - versionCode 4 - versionName "2.0.0-RC3" + versionCode 5 + versionName "2.0.0-RC4" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" @@ -68,7 +68,7 @@ publish { userOrg = 'tonyofrancis' groupId = 'com.tonyodev.fetch2rx' artifactId = 'fetch2rx' - publishVersion = '2.0.0-RC3' + publishVersion = '2.0.0-RC4' desc = 'RxJava extensions for Fetch2' website = 'https://github.com/tonyofrancis/fetch' } diff --git a/fetchmigrator/build.gradle b/fetchmigrator/build.gradle index a0347c57..09cde7bb 100644 --- a/fetchmigrator/build.gradle +++ b/fetchmigrator/build.gradle @@ -20,8 +20,8 @@ android { defaultConfig { minSdkVersion library_min_version targetSdkVersion library_target_version - versionCode 4 - versionName "2.0.0-RC3" + versionCode 5 + versionName "2.0.0-RC4" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" @@ -67,7 +67,7 @@ publish { userOrg = 'tonyofrancis' groupId = 'com.tonyodev.fetchmigrator' artifactId = 'fetchmigrator' - publishVersion = '2.0.0-RC3' + publishVersion = '2.0.0-RC4' desc = 'Migration Assistant for Fetch' website = 'https://github.com/tonyofrancis/fetch' } diff --git a/sampleApp/build.gradle b/sampleApp/build.gradle index 427896f1..70fb220f 100644 --- a/sampleApp/build.gradle +++ b/sampleApp/build.gradle @@ -11,8 +11,8 @@ android { applicationId "com.tonyodev.fetchapp" minSdkVersion library_min_version targetSdkVersion library_target_version - versionCode 3 - versionName "2.1" + versionCode 4 + versionName "2.2" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } buildTypes { diff --git a/sampleApp/src/main/java/com/tonyodev/fetchapp/App.java b/sampleApp/src/main/java/com/tonyodev/fetchapp/App.java index 7f4d567d..e6bba2f4 100644 --- a/sampleApp/src/main/java/com/tonyodev/fetchapp/App.java +++ b/sampleApp/src/main/java/com/tonyodev/fetchapp/App.java @@ -35,7 +35,6 @@ public Fetch getFetch() { final boolean enableLogging = true; fetch = new Fetch.Builder(this, "DefaultFetch") .setLogger(logger) - .setDownloadConcurrentLimit(4) // .setDownloader(okHttpDownloader) .setDownloadConcurrentLimit(concurrentLimit) .enableLogging(enableLogging)