tonyofrancis / Fetch

The best file downloader library for Android
https://www.meta.stackoverflow.com/tags/fetch2
Apache License 2.0
1.66k stars 343 forks source link

Slow download start #456

Closed visuall closed 4 years ago

visuall commented 5 years ago

Hi,

For some reason the download lib takes really long time to start a new download when used on device ( like Minix or AndroidTV ) with removable storage ( SD card or USB flash ). When I use it on a smartphone for example all works well and download starts in less than 10s after being added to queue. The same thing on device with removable storage can take minutes. The enqueue request completes and the request is added to queue but never starts. Log does not show any errors. It just waits ( no waiting for network are fired too ). And at some point it starts. For simplicity the configuration is with 1 concurrent download allowed only. All settings are the default ones in the config.

Thanks in advance!

tonyofrancis commented 4 years ago

You may want to use the ParallelDownloader. FetchConfiguration..setHttpDownloader(new HttpUrlConnectionDownloader(Downloader.FileDownloaderType.PARALLEL))

LunevNF commented 4 months ago

Last version (3.2.0) - same problem. Fix this problem:

com.tonyodev.fetch2.helper.PriorityListProcessorImpl

private fun increaseBackOffTime() {
    /*backOffTime = if (backOffTime == DEFAULT_PRIORITY_QUEUE_INTERVAL_IN_MILLISECONDS) {
        ONE_MINUTE_IN_MILLISECONDS
    } else {
        backOffTime * 2L
    }*/
    backOffTime += 500
    val minutes = TimeUnit.MILLISECONDS.toMinutes(backOffTime)
    logger.d("PriorityIterator backoffTime increased to $minutes minute(s)")
}