mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-12-23 08:51:48 +01:00
Downloads now retry requests after some seconds. Closes #271
This commit is contained in:
parent
0a27d4e185
commit
5385642a5b
@ -26,6 +26,7 @@ import timber.log.Timber
|
|||||||
import java.io.File
|
import java.io.File
|
||||||
import java.io.FileReader
|
import java.io.FileReader
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
import java.util.concurrent.TimeUnit
|
||||||
|
|
||||||
class DownloadManager(private val context: Context, private val sourceManager: SourceManager, private val preferences: PreferencesHelper) {
|
class DownloadManager(private val context: Context, private val sourceManager: SourceManager, private val preferences: PreferencesHelper) {
|
||||||
|
|
||||||
@ -238,7 +239,10 @@ class DownloadManager(private val context: Context, private val sourceManager: S
|
|||||||
}
|
}
|
||||||
Observable.just(page)
|
Observable.just(page)
|
||||||
}
|
}
|
||||||
.retry(2)
|
.retryWhen {
|
||||||
|
it.zipWith(Observable.range(1, 3)) { errors, retries -> retries }
|
||||||
|
.flatMap { retries -> Observable.timer((retries * 2).toLong(), TimeUnit.SECONDS) }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Public method to get the image from the filesystem. It does NOT provide any way to download the image
|
// Public method to get the image from the filesystem. It does NOT provide any way to download the image
|
||||||
|
Loading…
Reference in New Issue
Block a user