mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-09-19 12:26:13 -04:00
Keep trying to fetch metalinks despite errors
This commit is contained in:
parent
0d4994a2b9
commit
90c1bd9b0a
@ -32,6 +32,7 @@ import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.RandomAccessFile;
|
||||
import java.util.ArrayList;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
@ -165,7 +166,7 @@ public class DownloadService extends Service {
|
||||
|
||||
private void downloadBook(String url, int notificationID, LibraryNetworkEntity.Book book) {
|
||||
downloadFragment.addDownload(notificationID, book, KIWIX_ROOT + StorageUtils.getFileNameFromUrl(book.getUrl()));
|
||||
kiwixService.getMetaLinks(url)
|
||||
kiwixService.getMetaLinks(url).retryWhen(errors -> errors.flatMap(error -> Observable.timer(5, TimeUnit.SECONDS)))
|
||||
.subscribeOn(AndroidSchedulers.mainThread())
|
||||
.flatMap(metaLink -> getMetaLinkContentLength(metaLink.getRelevantUrl().getValue()))
|
||||
.flatMap(pair -> Observable.from(ChunkUtils.getChunks(pair.first, pair.second, notificationID)))
|
||||
|
Loading…
x
Reference in New Issue
Block a user